Most common price associated with a product

joshbjames

New Member
Joined
Jul 25, 2017
Messages
33
This is similar to a question I have asked before. Basically, I have a list of products and the product number repeats on a new row for every price variance we have sold it for. I would like to find the price we have sold it for most frequently.

Variables to account for would be:
1 - It has only been sold at one price. (Return that value).
2 - Two different prices occur the exact same amount of times. (Return the lowest of the 2 prices).
3 - No particular price occurred more than another (Return the lowest price).

Here is some sample data with as many scenarios I could think of and the result I'd like.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Product Number[/TD]
[TD]Price[/TD]
[TD]Most Common[/TD]
[/TR]
[TR]
[TD]1234[/TD]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]1234[/TD]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]1234[/TD]
[TD]1[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]5678[/TD]
[TD]3[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]9012[/TD]
[TD]4[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]9012[/TD]
[TD]5[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]9012[/TD]
[TD]4[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]9012[/TD]
[TD]5[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]9012[/TD]
[TD]3[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]3456[/TD]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3456[/TD]
[TD]3[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3456[/TD]
[TD]4[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]7890[/TD]
[TD]5[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]7890[/TD]
[TD]6[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Care to state per record which of the rules (Rule-1, Rule-2, and Rule-3) applies (in order to determine "most common" price?
 
Upvote 0
1234 - One price occurs most often, return that price.
5678 - Only one price exists, return that price.
9012 - The two most frequent prices occur the same amount of times, return the lower of the two.
3456 & 7890 - All the prices are different, return the lowest.
 
Upvote 0
1234 - One price occurs most often, return that price.
5678 - Only one price exists, return that price.
9012 - The two most frequent prices occur the same amount of times, return the lower of the two.
3456 & 7890 - All the prices are different, return the lowest.

Thanks. The following seems to cover above rules. It needs more testing though...

In C2 control+shift+enter, not just enter, and copy down:

=IF(COUNT(MODE.MULT(IF($A$2:$A$15=$A2,$B$2:$B$15)))>1,MIN(MODE.MULT(IF($A$2:$A$15=$A2,$B$2:$B$15))),IFERROR(MODE(IF($A$2:$A$15=$A2,$B$2:$B$15)),MIN(IF($A$2:$A$15=$A2,$B$2:$B$15))))
 
Upvote 0
Thanks, I will try this first thing in the morning and let you know! I tend to explain things in the most complicated way.

The basic idea is - Find the most frequent price. If nothing is more frequent return the lowest option. If two or more values tie for most frequent return the lowest (hopefully, that clarifies things).
 
Upvote 0
The basic idea is - Find the most frequent price. If nothing is more frequent return the lowest option. If two or more values tie for most frequent return the lowest (hopefully, that clarifies things).

Hi!

Try the Array Formula below too:

In C2 and copy down - use Ctrl+Shift+Enter to enter the formula

=IFERROR(MIN(MODE.MULT(IF($A$2:$A$15=A2,$B$2:$B$15))),MIN(IF($A$2:$A$15=A2,$B$2:$B$15)))


[TABLE="class: grid, width: 317"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]Product Number[/TD]
[TD="align: center"]Price[/TD]
[TD="align: center"]Most Common[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]1234[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]1234[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]1234[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]5678[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]9012[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]9012[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]9012[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]9012[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]9012[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]3456[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD="align: center"]3456[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD="align: center"]3456[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]14[/TD]
[TD="align: center"]7890[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]15[/TD]
[TD="align: center"]7890[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]16[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]***[/TD]
[TD="align: center"]***************[/TD]
[TD="align: center"]******[/TD]
[TD="align: center"]**************[/TD]
[TD="align: center"]**[/TD]
[/TR]
</tbody>[/TABLE]


Markmzz
 
Upvote 0
Thank you both so much! These were both helpful. You all helped me solve a problem that has been plaguing us at work for a very long time.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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