Max + vlookup ? Two columns, range column a, max of column b

JohnnySix

New Member
Joined
Dec 16, 2009
Messages
19
Using column 'A' as a measure, how would I pick the highest value on Column 'B' - is there a way to do this without ARRAY formulas ?

Say I have a layout something like so - if I wanted 'MAX' for the 16th of FEB, it should pick 321.00

16-Feb-14321.00
16-Feb-1432.00
16-Feb-14213.00
16-Feb-1432.00
16-Feb-1468.00
21-Feb-145,842.00
21-Feb-14684.00
21-Feb-143,215.00
24-Feb-1421,561.00
25-Feb-1458.00
26-Feb-1456,185.00
27-Feb-14215.00
27-Feb-14561.00
27-Feb-1421.00
02-Mar-143,218.00
03-Mar-14321.00
04-Mar-143,218.00
04-Mar-14321.00
04-Mar-1482.00
07-Mar-14854.00
08-Mar-14384.00

<colgroup><col><col></colgroup><tbody>
</tbody>

I asked our resident excel guy, and he said the only way to do it was to break it into separate columns for each date on another worksheet and find the max from that.

Is there not a more elegant solution, similar to something like SUMIFS / SUMIF , else I can see the spreadsheet getting VERY slow with so many columns running calculations.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
IF you sort the date column ascending and the value column ascending

Then

=LOOKUP(G2,A1:A21,B1:B21) where G2 is the date you want to check against this will return the max figure for the date
 
Upvote 0
I found a pretty interesting way to do this, but you will need an extra column.. I'll try and explain as best I can.

If you find a way to populate Column F with the first instance of a new date ( so no repeats... which can be done, there are many posts on this forum like that, i just dont know it off the top of my head), for now, you can insert them manually...

so assuming column F has a date that matches exactly to the date in column A you can use this
=IF(ISBLANK(MATCH(F2,$A$1:$A$21,0)),MAX(INDIRECT("B"&(MATCH(F1,$A$1:$A$21,0)))),MAX(INDIRECT("B"&(MATCH(F1,$A$1:$A$21,0))&":B"&(MATCH(F2,$A$1:$A$21,0))-1)))

so for example, Feb 16 has 5 instances of Feb 16 in column A.
when I use MATCH(F2,$A$1:$A$21,0))-1, it will return the row position of Feb 21, subtract 1 from it, giving row number 5.
indirect passes a range to the MAX function which I intelligently used ("B"&)...
at that point MAX knows which range to use at each date.
 
Upvote 0
Using column 'A' as a measure, how would I pick the highest value on Column 'B' - is there a way to do this without ARRAY formulas ?

16-Feb-14321.00
16-Feb-1432.00
16-Feb-14213.00
16-Feb-1432.00
16-Feb-1468.00
21-Feb-145,842.00
21-Feb-14684.00
21-Feb-143,215.00
24-Feb-1421,561.00
25-Feb-1458.00
26-Feb-1456,185.00
27-Feb-14215.00
27-Feb-14561.00
27-Feb-1421.00
02-Mar-143,218.00
03-Mar-14321.00
04-Mar-143,218.00
04-Mar-14321.00
04-Mar-1482.00
07-Mar-14854.00
08-Mar-14384.00

<tbody>
</tbody>

Any particular reason not to use an array formula?

If the information above starts in A1 and the date you are searching is in cell A23 then the following array formula is pretty simple:

{=MAX(IF(($A$1:$A$21=$A$23),$B$1:$B$21))}

(entered with Ctrl+Shift+Enter)
 
Upvote 0
Assuming same set up as my previous post think this will achieve the same result without using an array formula:

=MAX(OFFSET(INDIRECT(CONCATENATE("B",MATCH($A$23,$A$1:$A$21,0)),1),0,0,COUNTIF($A$1:$A$21,$A$23),1))
 
Upvote 0
Data Starts from A1 to B21. D1 houses the date you wish to extract the MAX of: Put this formula in F1 and wrap into a sumproduct. In this way you do not have to press Ctrl=Shift+enter, if that is what you are after for not using an array formula.
=SUMPRODUCT(MAX(--($A$1:$A$21=$D$1)*$B$1:$B$21))
 
Upvote 0
Similar concept to JBorg and for Excel 2010 or later.

Excel Workbook
ABCDE
1DateValueDate of InterestMax
216-Feb-1432116-Feb-14321
316-Feb-1432
416-Feb-14213
516-Feb-1432
616-Feb-1468
721-Feb-145,842.00
821-Feb-14684
921-Feb-143,215.00
1024-Feb-1421,561.00
1125-Feb-1458
1226-Feb-1456,185.00
1327-Feb-14215
1427-Feb-14561
1527-Feb-1421
162-Mar-143,218.00
173-Mar-14321
184-Mar-143,218.00
194-Mar-14321
204-Mar-1482
217-Mar-14854
228-Mar-14384
23
Max
 
Upvote 0
This formula can be used also
It must be pressure on the "CTRL + SHIFT + ENTER"
{=MAX(IF($A$2:$A$22=D2;$B$2:$B$22))}
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,814
Members
449,340
Latest member
hpm23

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