# Find last row containing a given value

#### rez13

##### New Member

I want to scan a range of rows for any cell which contain a given value. What I need returned is the maximum row number (i.e. last row) which contains the given value.

Thanks!

### Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
L

#### Legacy 51064

##### Guest
This should do the trick for you:

=INDEX(A:A,MATCH(9.99999999999999E307,A:A))
=LOOKUP(9.99999999999999E+307,A:A)
=MATCH(9.99999999999999E+307,A:A)

#### rez13

##### New Member
Thanks 98illini. But I'm not sure how to apply what you're saying - where in the formulae do I enter my given value?
Perhaps I should explain my specific problem:

I have 3 projects - let's call them PR1,PR2,PR3. Each project has a row in a Project Summary sheet.

In another sheet of the workbook I have:
In A2:A101. a series of ascending dates (i.e. representing 100 days).
Columns B-I representing the 8 working hours in each day. So each cell in B2-I101 represents a working hour on a certain date.

In B2:I101 the project codes (PR1, PR2) etc. are entered, indicating on which dates and in which hour work on each project is scheduled to be done.
Any cell B2:I101 could contain any of the 3 project codes, and each code could appear in more than one "hour cell".

In my Project Summary sheet, what I need to look up is the latest date in A2:A101 on which work for each particular project is scheduled.
If I move the project codes about to re-schedule work, I want the "latest" date in the summary shet to automatically update.

Hope you can solve this one & Thanx!

#### barry houdini

##### MrExcel MVP
Try this formula

=MAX(IF(\$B\$2:\$I\$101="PR1",A\$2:\$A\$101))

confirmed with CTRL+SHIFT+ENTER

#### rez13

##### New Member

Brilliant!

Thanks Barry. The solution didn't escape you - ha ha!

#### barry houdini

##### MrExcel MVP
Hey! houdini gags, I like it

#### Yogi Anand

##### MrExcel MVP
Hi rez13:

If the dates in column A are always in ascending order, Barry's formula will give you the correct result, however, if it can not be guaranteed that the dates in column A will always be in ascending order, I suggest you use the following array formula ...

=INDEX(A:A,MAX(IF(\$B\$2:\$I\$109="PR1",ROW(\$B\$2:\$I\$109))))

Replies
1
Views
256
Replies
11
Views
398
Replies
3
Views
444
Replies
3
Views
144
Replies
2
Views
253

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,163,806
Messages
5,833,778
Members
430,232
Latest member
Testsubject

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back