Finding the last match in a list

rowett

Board Regular
Joined
Jun 10, 2002
Messages
116
I want to be able to find the last match in a list. To find the first match I use the MATCH worksheet function. For example MATCH("Chris", A1:A5, 0) finds the index of the first cell in the range A1:A5 containing the text "Chris".

How do I find the LAST cell in the range that contains "Chris"?

Many thanks,
Chris
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Perfect for what? Could you post a sample along with the desired result?

I was trying to create a summary page for car maintenance log. Here is the result:
Code:
=INDEX(maint_data[#All],SUMPRODUCT(MAX((maint_data[Maintenance Type]=A17)*(ROW(maint_data[Maintenance Type])))),3)

The summary page has a list of maintenance types (oil change, tire rotation, brake inspection, etc.). On the maintenance page, I keep a running log of all maintenance actions. The summary page then displays when the last action of the type was, and calculates when the next one is due based on my manual's recommended cycle.
 
Upvote 0
@ soccerkingpilot

Could you post 10 rows from this table (with headers included) along with the desired result for that bit of 10 rows?
 
Upvote 0
@ soccerkingpilot

Could you post 10 rows from this table (with headers included) along with the desired result for that bit of 10 rows?

SUMMARY TABLE:
[TABLE="width: 500"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Maintenance Cycles[/TD]
[TD]Schedule[/TD]
[TD]Last Service[/TD]
[TD]Next Service[/TD]
[/TR]
[TR]
[TD]Air Filter[/TD]
[TD] 12,000[/TD]
[TD]18,890[/TD]
[TD] 30,890[/TD]
[/TR]
[TR]
[TD]Oil Change[/TD]
[TD] 6,000[/TD]
[TD]18,890[/TD]
[TD] 24,890[/TD]
[/TR]
[TR]
[TD]Tire Rotation[/TD]
[TD] 6,000[/TD]
[TD]13,397[/TD]
[TD] 19,397[/TD]
[/TR]
[TR]
[TD]Cabin Air Filter[/TD]
[TD] 12,000[/TD]
[TD]14,100[/TD]
[TD] 26,100[/TD]
[/TR]
[TR]
[TD]Brake Inspection[/TD]
[TD] 12,000[/TD]
[TD]13,397[/TD]
[TD] 25,397[/TD]
[/TR]
</tbody>[/TABLE]

MAINTENANCE DATA:
[TABLE="width: 344"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Date[/TD]
[TD]Maintenance Type[/TD]
[TD]Odometer[/TD]
[/TR]
[TR]
[TD]01-Jul-18[/TD]
[TD]Oil Change[/TD]
[TD="align: right"]6,954[/TD]
[/TR]
[TR]
[TD]03-Jul-18[/TD]
[TD]Tire Rotation[/TD]
[TD="align: right"]7,015[/TD]
[/TR]
[TR]
[TD]08-Sep-18[/TD]
[TD]Oil Change[/TD]
[TD="align: right"]13,019[/TD]
[/TR]
[TR]
[TD]16-Sep-18[/TD]
[TD]Engine Air Filter Change[/TD]
[TD="align: right"]13,235[/TD]
[/TR]
[TR]
[TD]05-Oct-18[/TD]
[TD]Tire Rotation[/TD]
[TD="align: right"]13,397[/TD]
[/TR]
[TR]
[TD]05-Oct-18[/TD]
[TD]Brake Inspection[/TD]
[TD="align: right"]13,397[/TD]
[/TR]
[TR]
[TD]28-Oct-18[/TD]
[TD]Cabin Air Filter[/TD]
[TD="align: right"]14,100[/TD]
[/TR]
[TR]
[TD]18-Jan-19[/TD]
[TD]Oil Change[/TD]
[TD="align: right"]18,890[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
That's the engine air filter.


Book1
ABCDEFGHI
1DateMaintenance TypeOdometerMaintenance CyclesScheduleLast ServiceNext Service
21-Jul-18Oil Change6,954Engine Air Filter12,00013,23525,235
33-Jul-18Tire Rotation7,015Oil Change6,00018,89024,890
48-Sep-18Oil Change13,019Tire Rotation6,00013,39719,397
516-Sep-18Engine Air Filter Change13,235Cabin Air Filter12,00014,10026,100
65-Oct-18Tire Rotation13,397Brake Inspection12,00013,39725,397
75-Oct-18Brake Inspection13,397
828-Oct-18Cabin Air Filter14,100
918-Jan-19Oil Change18,890
Sheet1


In H2 enter and copy down:

=LOOKUP(9.99999999999999E+307,SEARCH(F2,maint_data[Maintenance Type]),maint_data[Odometer])
 
Upvote 0

Forum statistics

Threads
1,223,931
Messages
6,175,465
Members
452,646
Latest member
tudou

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
Back
Top