Excel formulae to find row number of first instance and last of a value in a 2d array

coldturkey

New Member
Joined
Dec 3, 2019
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I have a table with Dates in a row and times in the columns I need to find the date when the first instance of a particular value occurs. The value can and does occur more than once. I also need a second formula to find the date of the last occurence. For example the first occurence of BRo is 25/11/2020 and the last is 9/12/20. I can't use a UDF as the work environment is locked down. (Note I am running Windows 10 and Excel 2019)
Thanks in advance.
Screenshot 2020-12-13 174054.jpg
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Please Use this:
1. Change $A$2:$A$37 to your Date Columns Range
2. Change $B$2:$E$37 to Your Find (search Range)
For First:
Excel Formula:
=INDEX($A$2:$A$37,AGGREGATE(15,3,(($B$2:$E$37="BRO")/($B$2:$E$37="BRO")*ROW($B$2:$E$37))-ROW($B$1),1))

For Last:
Excel Formula:
=INDEX($A$2:$A$37,AGGREGATE(14,3,(($B$2:$E$37="BRO")/($B$2:$E$37="BRO")*ROW($B$2:$E$37))-ROW($B$1),1))
 
Upvote 0
Solution
Please Use this:
1. Change $A$2:$A$37 to your Date Columns Range
2. Change $B$2:$E$37 to Your Find (search Range)
For First:
Excel Formula:
=INDEX($A$2:$A$37,AGGREGATE(15,3,(($B$2:$E$37="BRO")/($B$2:$E$37="BRO")*ROW($B$2:$E$37))-ROW($B$1),1))

For Last:
Excel Formula:
=INDEX($A$2:$A$37,AGGREGATE(14,3,(($B$2:$E$37="BRO")/($B$2:$E$37="BRO")*ROW($B$2:$E$37))-ROW($B$1),1))
That works perfectly. Thank you for posting solution so quickly.
I tried to use evaluate formula to see exactly what was going on but it just locks up my CPU for quite a while and then produces the answer without going through any intermediate steps. The formula itself works really quickly.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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