Two max values in an array to show as reslut

asad

Well-known Member
Joined
Sep 9, 2008
Messages
1,434
I got the following table
Excel Workbook
AB
2SALTSIDIS hasn't paid in on more occassions than anybody else.
3
413/01/2011SANTIN H
527/01/2011SALTSIDIS
630/01/2011SALTSIDIS
73/02/2011OV
86/02/2011NOVOTNY
910/02/2011LAST
1010/02/2011SINGH R
1110/02/2011ARATHOON
1218/02/2011KEELEY
1319/02/2011PETERU
1421/02/2011OV
1522/02/2011FINDLAY
1623/02/2011SOK
1725/02/2011SANTIN J
1826/02/2011SANTIN J
1927/02/2011SINGH K
201/03/2011SINGH R
211/03/2011PETERU
223/03/2011SCHULZ
235/03/2011SALVATORE
245/03/2011OV
258/03/2011VA
268/03/2011SOK
27
2810/03/2011LAST
2914/03/2011SINGH R
3014/03/2011VA
3115/03/2011SINGH R
3217/03/2011SCHULZ
3320/03/2011SALTSIDIS
3423/03/2011SALTSIDIS
3524/03/2011SINGH K
361/04/2011DERUM
373/04/2011SALTSIDIS
385/04/2011DERUM
398/04/2011PETERU
4011/04/2011FINDLAY
4112/04/2011SALTSIDIS
4212/04/2011SINGH K
4314/04/2011LAST
4419/04/2011VA
4518/04/2011SINGH K
4619/04/2011SINGH K
4719/04/2011HOLT
4820/04/2011FINDLAY
4924/04/2011SINGH K
5026/04/2011SINGH K
5125/04/2011SALVATORE
5228/04/2011DERUM
5330/04/2011SINGH K
545/05/2011SINGH K
5522/05/2011SCHULZ
5624/05/2011RIVERA
5724/05/2011FINDLAY
5831/05/2011DERUM
5931/05/2011SANTIN H
601/06/2011SALEH
613/06/2011SANTIN H
626/06/2011DERUM
637/06/2011SANTIN H
647/06/2011FINDLAY
659/06/2011PETERU
6612/06/2011SINGH K
6710/06/2011DERUM
6818/06/2011ROFAEL
6919/06/2011SALTSIDIS
7021/06/2011SALEH
7121/06/2011LAST
7224/06/2011OV
7325/06/2011SALEH
7424/06/2011HOWARD
7527/06/2011SALTSIDIS
7628/06/2011SALTSIDIS
7728/06/2011SALTSIDIS
78
79
Not Paid In and Shortages


In the above, the answer should be "SINGH K, SALTSIDIS hasn't paid in on more occassions than anybody else". But it shows SALTSIDIS only. SINGH K and SALTSIDIS are both occurring 10 times. How can I fix this issue?

Thanks for your help.

Asad
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
I am trying to use a helper cell. I am trying to get the two or more names in cells in the same row (Row#2) and then concanate them in B2. the formula I got so far is like this:
Code:
{=SMALL(INDEX($B$4:$B$501,MATCH(MAX(COUNTIF($B$4:$B$501,$B$4:$B$501)),COUNTIF($B$4:$B$501,$B$4:$B$501),0),1),COLUMNS($C2:C2))}

But it is not working. Can you guys please help me with this one?
 
Upvote 0
I tried this one too but no luck:
Code:
{=INDEX($B$4:$B$501,SMALL(MATCH(MAX(COUNTIF($B$4:$B$501,$B$4:$B$501)),COUNTIF($B$4:$B$501,$B$4:$B$501),0),COLUMNS($C2:C2)),1)}

This one gives me the same person as my original formula, and then gives error for the next one :confused:

Asad
 
Upvote 0
I tried this one too but no luck:
{=INDEX($B$4:$B$501,SMALL(MATCH(MAX(COUNTIF($B$4:$B$501,$B$4:$B$501)),COUNTIF($B$4:$B$501,$B$4:$B$501),0),COLUMNS($C2:C2)),1)}

This one gives me the same person as my original formula, and then gives error for the next one :confused:

Asad
Try this...

In the formulas Rng refers to B$4:B$77

Enter this array formula** in D4. This will return the count of the name(s) that appear the most often.

=MAX(COUNTIF(Rng,Rng))

Enter this array formula** in E4. This will return the count of how many names appear the most often.

=SUM(IF(FREQUENCY(MATCH(Rng&"",Rng&"",0),ROW(Rng)-MIN(ROW(Rng))+1)=D4,1))

Enter this array formula** in F4. This will return the name that appears the most often.

=INDEX(Rng,MODE(IF(Rng<>"",MATCH(Rng,Rng,0))))

Enter this array formula** in F5. This will return any other names that also appear the max number of times.

=IF(ROWS(F$4:F5)>E$4,"",INDEX(Rng,MODE(IF(Rng<>"",IF(COUNTIF(F$4:F4,Rng)=0,MATCH(Rng,Rng,0))))))

Copy down until you get blanks.
 
Upvote 0
Thanks a lot Biff,

I changed your formula a little bit because of my set up and it worked perfect. Here is a post for anybody else who want to use it:

Excel Workbook
ABCDEFG
2102SALTSIDISSINGH K
3SALTSIDIS SINGH K Haven't paid in on more occassions than anybody else.
Not Paid In and Shortages


Thanks again

Asad
 
Upvote 0
Try this...

In the formulas Rng refers to B$4:B$77

Enter this array formula** in D4. This will return the count of the name(s) that appear the most often.

=MAX(COUNTIF(Rng,Rng))

Enter this array formula** in E4. This will return the count of how many names appear the most often.

=SUM(IF(FREQUENCY(MATCH(Rng&"",Rng&"",0),ROW(Rng)-MIN(ROW(Rng))+1)=D4,1))

Enter this array formula** in F4. This will return the name that appears the most often.

=INDEX(Rng,MODE(IF(Rng<>"",MATCH(Rng,Rng,0))))

Enter this array formula** in F5. This will return any other names that also appear the max number of times.

=IF(ROWS(F$4:F5)>E$4,"",INDEX(Rng,MODE(IF(Rng<>"",IF(COUNTIF(F$4:F4,Rng)=0,MATCH(Rng,Rng,0))))))

Copy down until you get blanks.
I forgot to include the instructions on how to enter an array formula.
Enter this array formula**
** 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
Thanks a lot Biff,

I changed your formula a little bit because of my set up and it worked perfect. Here is a post for anybody else who want to use it:

Excel Workbook
ABCDEFG
2102SALTSIDISSINGH K
3SALTSIDIS SINGH K Haven't paid in on more occassions than anybody else.
Not Paid In and Shortages


Thanks again

Asad
You're welcome. Thanks for the feedback! :cool:
 
Upvote 0
In the formulas Rng refers to B$4:B$77

I have been trying to change the Rng reference so that it will take into consideration only those cells in $B$4:$B$500 that match up with date in $A$4:$A$500 and the date should be more than equal to $K$2.
I tried this
Code:
=IF($A$4:$A$500 > =$K$2,$B$4:$B$500)
as a ref to name Rng in Name Manager. But it does not work. What is it that I am doing wrong?

Asad
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,280
Members
452,902
Latest member
Knuddeluff

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