Find the last occurrence

30percent

Board Regular
Joined
May 5, 2011
Messages
123
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have the following formula:

=INDEX('Paste'!A:A,MATCH(TRIM(B36),'Paste'!A:A,0)+1)

What's the easiest way to tweak it so that instead of finding the first occurrence and returning its index, it would find the LAST OCCURRENCE?

thanks!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try this. Where I have 2000 use a number that will surely be larger than the number of rows of data in 'Paste' but I would avoid whole column references for those ranges.

Excel Formula:
=INDEX(Paste!A:A,AGGREGATE(14,6,ROW(Paste!A1:A2000)/(Paste!A1:A2000=TRIM(B36)),1)+1)
 
Upvote 0
If you are just trying to return the value below the last occurrence from the Paste sheet

=LOOKUP(99^99,IF(Paste!A1:A2000=TRIM(B36),Paste!A2:A2001))

You may have to confirm this with CTRL-SHIFT-ENTER
 
Upvote 0
If you are just trying to return the value below the last occurrence from the Paste sheet

=LOOKUP(99^99,IF(Paste!A1:A2000=TRIM(B36),Paste!A2:A2001))

You may have to confirm this with CTRL-SHIFT-ENTER
We don't know what format the OP's data is, but wouldn't that only work if all the values in Paste immediately below whatever the B36 value is are numerical?
For example, it returns 55 here instead of "www"

24 03 27.xlsm
A
1
2b
3a
455
5
6
7
8
9a
10www
11z
1222
13
Paste


24 03 27.xlsm
BC
36a55
30percent
Cell Formulas
RangeFormula
C36C36=LOOKUP(99^99,IF(Paste!A1:A2000=TRIM(B36),Paste!A2:A2001))
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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