INDIRECT MAX with criteria (variable range length)

dellzy

Board Regular
Joined
Apr 24, 2013
Messages
146
Hello experts,

I got the below formula to find MAX date when meet a criteria:-

=IF($P2="","",MAX(IF($A3:$A$9999=$A2,$P3:$P$9999))) with Ctrl+Shift+Enter

However, I have a situation where the last row of the range is variable.. meaning, it may not be only row 9999. And the start row of the range must always follow the row below the current row (where the formula is applied). It will grow for day to day, as the data will be added on daily basis. When I tried to change as below, I got error #VALUE!. Can anybody correct me, please?

=IF(INDIRECT("$P"&ROW())="","",MAX(IF(INDIRECT("$A"&ROW()+1&":$A$"&COUNT(A:A))=INDIRECT("$A"&ROW()),INDIRECT("$A"&ROW()+1&":$A$"&COUNT(A:A))))) with Ctrl+Shift+Enter

Thank you in advance.

DZ
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
In A1 enter:

=MATCH(9.99999999999999E+307,P:P)

Now invoke: Control+shift+enter...

=IF($P2="","",MAX(IF($A3:INDEX($A:$A,$A$1)=$A2,$P3:INDEX($P:$P,$A$1))))

This adjusts automatically to the changing ranges.
 
Upvote 0
Wow! Thanks so much for the swift response, !

It works awesomely!! Yeayyy!

Really appreciate it! :)
 
Upvote 0

Forum statistics

Threads
1,215,999
Messages
6,128,192
Members
449,431
Latest member
Taekwon

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