Vlookup and MAX not working.

gedkins

New Member
Joined
Sep 30, 2014
Messages
15
Hi,

I am working with a pivot table and attempting to extract the highest value (count) found and returning a user name based on that. I am getting the dreaded N/A as a result of my formula. I am running Excel 2010. Here is the test case I have.


[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[/TR]
[TR]
[TD]Bob[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Fred[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Bill[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Sam[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]








in a cell elsewhere on the sheet I have the following formula: =VLOOKUP(MAX(B2:B5),A2:B5,1,0). I get N/A. Any idea how to solve this problem? I would expect Sam as the value.
 
Last edited:

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
try this instead

=INDEX(A2:A5,MATCH(MAX(B2:B5),B2:B5,0))

if you really need to use vlookup(), swap columns A & B like this


Excel 2012
AB
1AB
21Bob
32Fred
43Bill
54Sam
6
7Sam
Sheet5
Cell Formulas
RangeFormula
A7=VLOOKUP(MAX(A2:A5),A2:B5,2,0)
 
Upvote 0
INDEX/MATCH is the proper solution, but, just for fun, to use VLOOKUP with the columns in the wrong order, try:
=VLOOKUP(MAX(B2:B5),CHOOSE({1,2},B2:B5,A2:A5),2,0)

M.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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