Maximum Result for Each Name

erenkey

Board Regular
Joined
Dec 9, 2005
Messages
162
I have a spreadsheet that contains names in Column A and a number in Column B. What is the easiest way to determine the maximum number for each name in column A?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
a pivot table

013.gif
 
Last edited:
Upvote 0
How would I use Countif? My data looks like this:

Cloumn A Column B
John 10
John 11
John 12
Chris 13
Chris 14
Chris 15
Bob 16
Bob 17
Bob 18

I want my result to show:

John 12
Chris 15
Bob 18

Each name could be in the list up to 3 times.
 
Upvote 0
I have a spreadsheet that contains names in Column A and a number in Column B. What is the easiest way to determine the maximum number for each name in column A?
One way...

If you a unique list of the names:

Book1
ABCDE
2Name135_Name135
3Name122_Name262
4Name262_Name364
5Name260_Name475
6Name258_Name584
7Name24___
8Name364___
9Name35___
10Name475___
11Name460___
12Name427___
13Name420___
14Name584___
15Name542___
Sheet1

Enter this array formula** in E2 and copy down as needed:

=MAX(IF(A$2:A$15=D2,B$2:B$15))

** array formulas need to be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT key then hit ENTER.
 
Upvote 0
that works fine if I find a unique list of names using a pivot table first. Is there a way to find the unique list of names, find the max value for each name and then sort descending by max value using a VBA code?
 
Upvote 0
that works fine if I find a unique list of names using a pivot table first. Is there a way to find the unique list of names, find the max value for each name and then sort descending by max value using a VBA code?
I'm sure that could be done using VBA code but I'm also sure you'd want it done by someone who knows what they're doing! So, that eliminates me! :eeek:

Maybe someone will come along and post some code to do this.

If not, after a day or 2 maybe repost and be very explicit when you do post telling us you want to do this with VBA code.
 
Upvote 0
So, I assume you must have some good reason why you don't want to just use a simple pivot table like I posted in my first reply....

with that assumption.....

and reserving row 1 for column headers...so that the first actual name is in cell A2

we can build our unique list beginning in cell B2 using this array formula where LIST is a named region that holds your long list of names and duplicates

in cell B2
{=INDEX(LIST,MATCH(0,COUNTIF($B$1:B1,LIST),0))}

array formula : CTRL SHIFT ENTER

drag down as needed

then you can use the formula posted earlier by Biff in C2 and down to find corresponding max values...
 
Upvote 0
Sorry, I did not see your post earlier. The pivot table did not come through when I opened the thread. I can use a pivot table to find the unique name list and then use the Max/If formula to find the maximum value for each unique name. If I was the end user of this spreadsheet then I would stop there. I was trying to find a VBA code that would do everything including sorting the list descending so that the enduser would only have to run a Macro to get their answer.
 
Upvote 0

Forum statistics

Threads
1,224,531
Messages
6,179,379
Members
452,907
Latest member
Roland Deschain

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