Find the mode of column B for each unique number in column A

mrpolyglot

New Member
Joined
Apr 15, 2014
Messages
3
Hi all,

I am new to this forum, and really need help with the following task:

1) I have a list of of random numbers in column A
2) I have a second list of random numbers in column B
3) Would like to find the mode of column B for each unique number in column A

For example:

Column A, Column B
1, 2
1, 18
2, 7
18, 9
5, 17
1, 2
18, 4
5, 17
2, 3
2, 7
1, 2

Is there a formula that could find the mode of column B for each unique number in column A, and place each unique number (sorted) in column C and the mode in column D:

Column C, Column D
1, 2
2, 7
5, 17
18, N/A

I know how to manually do this, but cannot for the life of me perform the same via a formula in Excel. Thank you in advance for your help. It is greatly appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
XY4
12X UniqueMode Y while X
11812
2727
189517
51718#N/A
12
184
517
23
27
12

<COLGROUP><COL style="WIDTH: 48pt" span=2 width=64><COL style="WIDTH: 62pt; mso-width-source: userset; mso-width-alt: 2929" width=82><COL style="WIDTH: 101pt; mso-width-source: userset; mso-width-alt: 4778" width=134><TBODY>
</TBODY>

C1:
Rich (BB code):
=SUM(IF(FREQUENCY(A2:A12,A2:A12),1))

C3, control+shift+enter (CSE), not just enter, and copy down:
Rich (BB code):
=IF(ROWS($C$3:C3)<=$C$1,MIN(IF(ISNUMBER(MATCH($A$2:$A$12,$C$2:C2,0)),"#",
  IF(ISNUMBER($A$2:$A$12),$A$2:$A$12,"#"))),"")

D3, CSE and copy down:
Rich (BB code):
=IF($C3="","",MODE(IF($A$2:$A$12=$C3,$B$2:$B$12)))
 
Upvote 0

Forum statistics

Threads
1,215,475
Messages
6,125,028
Members
449,205
Latest member
Eggy66

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