Excel Formula; MODE texts based on two criteria

L

Legacy 509827

Guest
Guys,

Please help! I am trying to find the mode of column D (Most frequent product) with criteria of "Discrepancy" & "Snack Cake"

1693008738617.png
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Welcome to the MrExcel forum!

Try:

Book1
ABCDEFG
1
2
3Type of IssueDateProduction LinesProductMode
4DiscrepancySnack CakeTwinkieHoHo
5DiscrepancySnack CakeHoHo
6DiscrepancybTwinkie
7DiscrepancybHoHo
8aSnack CakeMuffin
9DiscrepancySnack CakeHoHo
10bbMuffin
11DiscrepancySnack CakeMuffin
12cbTwinkie
13DiscrepancySnack CakeTwinkie
14DiscrepancybHoHo
15eSnack CakeHoHo
16eSnack CakeTwinkie
17DiscrepancySnack CakeHoHo
18
Sheet2
Cell Formulas
RangeFormula
G4G4=INDEX(D4:D17,MODE(FILTER(MATCH(D4:D17,D4:D17,0),(A4:A17="Discrepancy")*(C4:C17="Snack Cake"))))
 
Upvote 0
Welcome to the MrExcel forum!

Try:

Book1
ABCDEFG
1
2
3Type of IssueDateProduction LinesProductMode
4DiscrepancySnack CakeTwinkieHoHo
5DiscrepancySnack CakeHoHo
6DiscrepancybTwinkie
7DiscrepancybHoHo
8aSnack CakeMuffin
9DiscrepancySnack CakeHoHo
10bbMuffin
11DiscrepancySnack CakeMuffin
12cbTwinkie
13DiscrepancySnack CakeTwinkie
14DiscrepancybHoHo
15eSnack CakeHoHo
16eSnack CakeTwinkie
17DiscrepancySnack CakeHoHo
18
Sheet2
Cell Formulas
RangeFormula
G4G4=INDEX(D4:D17,MODE(FILTER(MATCH(D4:D17,D4:D17,0),(A4:A17="Discrepancy")*(C4:C17="Snack Cake"))))
Thank you! However, this unfortunately did not work on my spreadsheet. It returned a #CALC error, tried changing it around and kept returning N/A error.

1693013112089.png
 
Upvote 0
Sorry, I expected more rows. The formula will return the N/A error if there's only 1 value. Try this variation instead:

Book1
ABCDEFG
1
2
3Type of IssueDateProduction LinesProductMode
4DiscrepancySnack CakeTwinkieTwinkie
5
Sheet2
Cell Formulas
RangeFormula
G4G4=INDEX(D4:D17,MODE({1,1}*FILTER(MATCH(D4:D17,D4:D17,0),(A4:A17="Discrepancy")*(C4:C17="Snack Cake"))))


The only difference is the {1,1}* part. You'll still get the CALC error if there are no matching rows.
 
Upvote 0
Hey thank you so much! Both actually worked, the first one I just tested one row. I realized I needed to put more than the one than one row. The sheet will be populated daily so it will be filled so its fine. Tweaked it a bit to add if empty/if error criteria for the #calc error, and its great. Definitely could not figure this one out! Thanks again.

I had a small concern on the FILTER function incase someone with a 2019 excel file views the file if they will see the result… but I’d test it out.
 
Upvote 0
This version should work on older versions of Excel:

Excel Formula:
=INDEX(D4:D17,MODE(IF((A4:A17="Discrepancy")*(C4:C17="Snack Cake"),MATCH(D4:D17,D4:D17,0)*{1,1},"")))

It needs to be confirmed with Control+Shift+Enter, not just Enter. Glad I could help!
 
Upvote 0
Solution

Forum statistics

Threads
1,215,365
Messages
6,124,513
Members
449,168
Latest member
CheerfulWalker

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