referring cells range
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Referring to cells in a range

Referring to cells in a range

resolvedResolved · Low Priority · Version 2007

replyReply Sun 22 Jan 2012, 19:34Delegate Roger said...

Roger has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course

Referring to cells in a range

I'm trying to avoid using VBA for something...

I want to find the value in the first cell in a named range. I think I can do this with Range.Cells in VBA, but is there a way to do it on the spreadsheet alone?

If it's called TestRange, I guess I am looking for something like "=TestRange(Cell1)", but I can find no evidence that such a thing exists.

Any suggestions gratefully received.

Roger

For upcoming training course dates see: Pricing & availability

replyReply Mon 23 Jan 2012, 10:28Trainer Doug said...

RE: referring to cells in a range

Morning Roger

Yes, you can find a value in a range without using VBA by using the INDEX function.

In any cell of your workbook containing a range called TestRange try typing:

=INDEX(TestRange,1,1)

The Index function returns the value at the position row 1, col 1 within the range TestRange.

Hope that helps.

Other example of Index
Index is sometimes used to find a value if a position in a range in known (throught the Match function)

A B
John 250
Sue 400
Rich 120
Val 300

Example
To find the person with the highest value without sorting type:

=INDEX(A1:A4,MATCH(MAX(B1:B4),B1:B4,0),1)

The Match function finds the postion 2 for Max value in B1:B4 and the Index function returns the value in that row of the range A1:A4 which is Sue!

Regards
Doug

Doug Dunn
Best STL

replyReply Mon 23 Jan 2012, 16:58Delegate Roger said...

RE: referring to cells in a range

Magic.

Thanks, Doug.

Roger

 

Please browse our web site to find out more about
access+training and other Microsoft training courses.

Access tip:

Dsum

You can create percentage values based on individual products / items by using a Dsum function (used with a grouped query)

[Each value column] / Dsum[field:total for the column needed to be calculated],[tablename]

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard