Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

referring cells range

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

ResolvedVersion 2007

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

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

RE: referring to cells in a range

Magic.

Thanks, Doug.

Roger

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Access tip:

Design View in Relationship window

Your in the Relationship window and changes are required to be made to a Table's design.

Rather than exiting the Relationship window, if you perform a right-mouse click on the table, it opens that table up in Design view

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.