Find last row containing a given value

rez13

New Member
Joined
Dec 8, 2005
Messages
3
Hi Excel world. Help please!

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
Joined
Dec 8, 2005
Messages
3
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
Joined
Mar 23, 2005
Messages
20,825
Try this formula

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

confirmed with CTRL+SHIFT+ENTER
 

rez13

New Member
Joined
Dec 8, 2005
Messages
3

ADVERTISEMENT

Brilliant!

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

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
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))))
 
Master Excel Bundle

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.

Forum statistics

Threads
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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top