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

lookup first occurance number

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Lookup first occurance of number

Lookup first occurance of number

ResolvedVersion 2010

Simon has attended:
Excel Intermediate course
Excel Advanced course
Excel Advanced - Formulas & Functions course
Excel VBA Intro Intermediate course
Excel VBA Advanced course
Excel Advanced - For Power Users course

Lookup first occurance of number

Hi, I would be grateful for some help.
I have a column of numbers and would like to count the number of rows before a specific number (e.g. 38.8) has its first occurrence. The context to this is the amount of time it takes a person to get to a certain temperature if each row is 1 min.
Many thanks
Simon

RE: Lookup first occurance of number

Hi Simon

Thanks for getting in touch.

The simplest option is MATCH. Here's an example:

=MATCH(38.8, A1:A50, 0)

Which will find the value "38.8" in the range of cells A1:A50. The zero ensures an exact match. The formula will return the answer in the form of a number. This number will count how many rows down the range the answer was found.

I hope this helps.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: Lookup first occurance of number

Thanks Gary, that works great. If there is not a 38.8 in the range, I get an N/A error what would I need to display the total rows, an if function?

RE: Lookup first occurance of number

Hi Simon

Try the always-useful IFERROR:

=IFERROR(MATCH(38.8, A1:A50, 0),COUNTA(A1:A150))

If the function returns an error, instead count how many entries are in the range and return that instead.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: Lookup first occurance of number

That works great, but I think the iferror function was developed for the 2010 version. I need it to be compatible with 2003 for work. Sorry didnt mention that, is there an alternative?

Edited on Sun 10 Mar 2013, 20:15

RE: Lookup first occurance of number

Hi Simon

Possible - just a little torturous:

=IF(ISERROR(MATCH(38.8, A1:A50, 0)), COUNTA(A1:A150), MATCH(38.8, A1:A50, 0))

You can see why IFERROR was invented!

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: Lookup first occurance of number

Thats brilliant, thank you, and on a Sunday! Thank you.

Excel tip:

Shortcuts for working with named ranges in Excel

If you are working with or creating named ranges in your spreadsheets, then you may find the following shortcut keys useful.

- Bring up the Define Names dialogue box on screen by using Ctrl + F3 (instead of going to Insert - Names).

- Create Names from labels you have entered into the spreadsheet by highlighting the labels and related figures, then hold down Shift + Ctrl + F3. You can then choose to create names from the top or bottom rows, or left or right columns.

- Go directly to a named range by hitting the F5 key. The Go To dialogue box will open and display any named ranges in the spreadsheet. Simply select the named range to navigate to it in the spreadsheet.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.