What function to find the most common values based off certain criteria?

miken54

New Member
Joined
Sep 18, 2017
Messages
20
Good Afternoon All,

This might seem easy to some, I just cant figure it out and I am not sure what keywords to enter if this was answered already.

I am the manager of an appliance retail store and I have a lot of new employees who are making simple errors. I was hoping there was a function I could enter into excel that would catch mistakes before the customer takes delivery. If we sell a washing machine, we generally speaking have two options of dryers we can sell that would match (gas or electric). So for example, if model # W1234 was sold, our dryer options would be DE123 or DG123.

Unfortunately, as of now I dont have a list of every corresponding dryer that matches each washer, so I was hoping that I could view all recent invoices that were sold, and find the most common dryers sold with each washer so that I could in essence create a list of the dryer options for each washer.

I have hundreds of lines of unique invoice numbers in column A and in Column B, it will show all of the model#'s that were sold on that invoice (please see below)

So the idea of the function I am looking for was to look up "A", find the washer model, and then find the dryer sold.

Then ultimately, in a different cell I want to show how many times each dryer was sold along with a washer so I can make a list of the most common dryers for each washer (something like this directly below in red)
D E F
WASHER DRYER OPTION 1 DRYER OPTION 2

and then create a different function to say something like "if in column A, washer model W1234 was sold AND dryer model DE123 OR DG123 was sold, then there is no error. However if washer W1234 was old and dryer DE500 was sold on that invoice, then create an error code.

If anyone has any suggestions on what function I could use, it would save me so many headaches haha. Thank you all, I really hope I explained this clearly.


AB
1INVOICE #MODEL#
2A100W1234
3A100DE123
4B100W1234
5B100DG123
6C100W5000
7C100DE500
8D100W4000
9D100DEG400
10E100W4000
11E100DG400
12F100W5000
13F100DE500
14

<tbody>
</tbody>





F100

<tbody>
</tbody>
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Book1
ABCDEFGHI
1INVOICE #MODEL#ABCDEF
2A100W1234W1234W1234W5000W4000W4000W5000
3A100DE123DE123DG123DE500DEG400DG400DE500
4A500W1234
5B100W1234
6B100DG123
7C100W5000
8C100DE500
9D100W4000
10D100DEG400
11E100W4000
12E100DG400
13F100W5000
14F100DE500
Sheet1


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

=IFERROR(INDEX($B$2:$B$14,SMALL(IF(FREQUENCY(IF(LEFT($A$2:$A$14)=D$1,MATCH($B$2:$B$14,$B$2:$B$14,0)),ROW($B$2:$B$14)-ROW($B$2)+1),ROW($B$2:$B$14)-ROW($B$2)+1),ROWS(D$2:D2))),"")
 
Upvote 0
Hey,first off thanks for taking the time our if your day to look help me. Would you be so kind to help me with part 2? I thought I could figure it out but am having issues.

So basically I am looking to enter something into another cell which would tell me whether or not one of the possible dryers were sold or not. At this point I have my list that looks like this...

A B C
WASHER MODEL POSSIBLE DRYER 1 POSSIBLE DRYER 2
W1234 DE123 DG123
W5000 DE500 DG500

So if W1234 is the washer on invoice invoice A100 and the corresponding dryer is DE123 or DG123, then everything is okay.
But if W1234 is the wahsher on invoice B1000, and the dryer showing up on that invoice is DEG400, an error message would pop up

ABCDEFGHI
1INVOICE #MODEL#ABCDEF
2A100W1234W1234W1234W5000W4000W4000W5000
3A100DE123DE123DG123DE500DEG400DG400DE500
4A500W1234
5B100W1234
6B100DG123
7C100W5000
8C100DE500
9D100W4000
10D100DEG400
11E100W4000
12E100DG400
13F100W5000
14F100DE500

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

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

=IFERROR(INDEX($B$2:$B$14,SMALL(IF(FREQUENCY(IF(LEFT($A$2:$A$14)=D$1,MATCH($B$2:$B$14,$B$2:$B$14,0)),ROW($B$2:$B$14)-ROW($B$2)+1),ROW($B$2:$B$14)-ROW($B$2)+1),ROWS(D$2:D2))),"")
 
Upvote 0
Part 2...


Book1
ABCDEFG
1INVOICE #MODEL#WASHER MODELPOSSIBLE DRYER 1POSSIBLE DRYER 2
2A100W1234W1234DE123DG123
3A100DE123POSSIBLEW5000DE500DG500
4A500W1234
5B100W1234
6B100DG123POSSIBLE
7C100W5000
8C100DE500POSSIBLE
9D100W4000
10D100DEG400NOT POSSIBLE
11E100W4000
12E100DG400NOT POSSIBLE
13F100W5000
14F100DE500POSSIBLE
Sheet1 (2)


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

=IF(LEFT($B2)="W","",IF(ISNUMBER(MATCH($B2,INDEX($E$2:$F$3,MATCH(LOOKUP(9.99999999999999E+307,SEARCH("W",IF($A$2:$A$14=$A2,$B$2:$B$14)),$B$2:$B$14),$D$2:$D$3,0),0),0)),"POSSIBLE","NOT POSSIBLE"))
 
Upvote 0
I feel like a total jerk for asking more because I already learned something incredible thanks to you today, but when you wrote "W", is that because the washers I listed all started with a "W"? If so I apologize for not being clear, this was just an example, my real report is much longer and had dozens of washer/dryer machines with different models. Some start with E, W, G, etc.

A B C D E F
INVOICEMODELWASHERDRYER OPTION 1 DRYER OPTION 2
86024571EFLS527UIWEFLS527UIWEFMG527UIWEFME527UIW
86024571EFMG527UIWWM3670HVADLGX3571VDLEX3571V
86059371WM3670HVAWAT28400UCWTG86400UCWTE86400UC
86059371DLEX3571VWCVH4800KWWDCVH480EKWWEFMG627UIW
86093981WCVH4800KWWEFLS627UTTEFME627UTTEFMG627UTT
86093981DCVH480EKWW
86127801EFMG617SIW
86127821EFMG617SIW
86075832EFLS617SIW
86075832EFME617SIW
86075832EPWD157SIW
86075832EPWD157SIW

<colgroup><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
You should have also posted the desired results...


Book1
ABCDEF
1INVOICEMODELWASHERDRYER OPTION 1DRYER OPTION 2
286024571EFLS527UIWEFLS527UIWEFMG527UIWEFME527UIW
386024571EFMG527UIWPOSSIBLEWM3670HVADLGX3571VDLEX3571V
486059371WM3670HVAWAT28400UCWTG86400UCWTE86400UC
586059371DLEX3571VPOSSIBLEWCVH4800KWWDCVH480EKWWEFMG627UIW
686093981WCVH4800KWWEFLS627UTTEFME627UTTEFMG627UTT
786093981DCVH480EKWWPOSSIBLE
886127801EFMG617SIWNOT POSSIBLE
986127821EFMG617SIWNOT POSSIBLE
1086075832EFLS617SIWNOT POSSIBLE
1186075832EFME617SIWNOT POSSIBLE
1286075832EPWD157SIWNOT POSSIBLE
1386075832EPWD157SIWNOT POSSIBLE
Sheet1 (3)


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

=IF(ISNUMBER(MATCH($B2,$D$2:$D$6,0)),"",IF(ISNUMBER(MATCH($B2,INDEX($E$2:$F$6,MATCH(VLOOKUP(A2,$A$1:$B1,2,0),$D$2:$D$6,0),0),0)),"POSSIBLE","NOT POSSIBLE"))
 
Upvote 0
I'm sorry. But thank you so much!!!

You should have also posted the desired results...

ABCDEF
1INVOICEMODELWASHERDRYER OPTION 1DRYER OPTION 2
286024571EFLS527UIWEFLS527UIWEFMG527UIWEFME527UIW
386024571EFMG527UIWPOSSIBLEWM3670HVADLGX3571VDLEX3571V
486059371WM3670HVAWAT28400UCWTG86400UCWTE86400UC
586059371DLEX3571VPOSSIBLEWCVH4800KWWDCVH480EKWWEFMG627UIW
686093981WCVH4800KWWEFLS627UTTEFME627UTTEFMG627UTT
786093981DCVH480EKWWPOSSIBLE
886127801EFMG617SIWNOT POSSIBLE
986127821EFMG617SIWNOT POSSIBLE
1086075832EFLS617SIWNOT POSSIBLE
1186075832EFME617SIWNOT POSSIBLE
1286075832EPWD157SIWNOT POSSIBLE
1386075832EPWD157SIWNOT POSSIBLE

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1 (3)

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

=IF(ISNUMBER(MATCH($B2,$D$2:$D$6,0)),"",IF(ISNUMBER(MATCH($B2,INDEX($E$2:$F$6,MATCH(VLOOKUP(A2,$A$1:$B1,2,0),$D$2:$D$6,0),0),0)),"POSSIBLE","NOT POSSIBLE"))
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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