Find most common occurrence and display it.

dad2sdt

New Member
Joined
Oct 24, 2014
Messages
8
Hi Community,

Been trying to figure this out all morning. I have a range of data, with column headers. I have computed values based on certain criteria in a range of cells Similar to the following: Lets call it clothing items.

Mon 400
Tue 300
Wed 6
Thur 7
Fri 50

I have computed this with the following formula: =COUNTIFS(Data!AN:AN,B9,Data!AI:AI,"Mon",Data!Z:Z,"SpecificText",Data!AQ:AQ,"AlternateText") replacing Tue, Wed...for Mon on each row. With this, I can see that I have sold 400 items on Monday, 300 on Tuesday...

Now out of those values, I want to display the most common occurrence of what made up that 763 items. I was trying to, unsuccessfully with the following formula based on some searches but I cannot figure it out. The goal is for Cell E26 to display the word Shirts, Pants, Shoes, based on if that is the most common thing sold that week. The item sold is in column AH of which I am trying to figure out which was sold most.

Cell E26: =INDEX(Data!AH:AH, 10000*MOD(MAX(COUNTIF(Data!AH2:AH1000000,Data!AH2:AH1000000)+(ROW(Data!AH2:AH1000000)/10000)),1), 1)

Any ideas welcomed.

Jeff

Jeff
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
8,994
It would have been helpful if you could have displayed an example of your sheets. Nevertheless, I tried to create a small sample derived from your formulas.

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>Z</th><th>AH</th><th>AI</th><th>AN</th><th>AQ</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">Mon</td><td style="text-align: right;;">2</td><td style="text-align: right;;"></td><td style=";">Most Common</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Pants</td><td style=";">Mon</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style=";">Tue</td><td style="text-align: right;;">3</td><td style="text-align: right;;"></td><td style=";">Shoes</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Shirts</td><td style=";">Mon</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">Wed</td><td style="text-align: right;;">2</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Pants</td><td style=";">Mon</td><td style=";">x</td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">Thur</td><td style="text-align: right;;">1</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Pants</td><td style=";">Tue</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style=";">Fri</td><td style="text-align: right;;">3</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Shoes</td><td style=";">Tue</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">7</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">Shoes</td><td style=";">Tue</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">8</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">Belts</td><td style="text-align: right;;"></td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">9</td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Shoes</td><td style=";">Tue</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">10</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Shoes</td><td style=";">Wed</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">11</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Shirts</td><td style=";">Wed</td><td style="text-align: right;;"></td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">12</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Shoes</td><td style=";">Wed</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">13</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Pants</td><td style=";">Wed</td><td style=";">x</td><td style="text-align: right;;"></td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">14</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Belts</td><td style=";">Thur</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">15</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Pants</td><td style=";">Fri</td><td style="text-align: right;;"></td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">16</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Pants</td><td style=";">Fri</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">17</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Shirts</td><td style=";">Fri</td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">18</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">Pants</td><td style="text-align: right;;"></td><td style=";">x</td><td style=";">AlternateText</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">19</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">SpecificText</td><td style=";">Shoes</td><td style=";">Fri</td><td style=";">x</td><td style=";">AlternateText</td></tr></tbody></table><p style="width:3.2em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Data</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Array Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">D3</th><td style="text-align:left">{=INDEX(<font color="Blue">Data!$AH$2:$AH$1000,MODE(<font color="Red">IF(<font color="Green">ISNUMBER(<font color="Purple">MATCH(<font color="Teal">Data!$AI$2:$AI$1000,{"Mon","Tue","Wed","Thur","Fri"},0</font>)</font>),IF(<font color="Purple">$Z$2:$Z$1000="SpecificText",IF(<font color="Teal">$AQ$2:$AQ$1000="AlternateText",IF(<font color="#FF00FF">$AN$2:$AN$1000=B9,IFERROR(<font color="Navy">MATCH(<font color="Blue">$AH$2:$AH$1000,$AH$2:$AH$1000,0</font>),""</font>)</font>)</font>)</font>)</font>)</font>)</font>)}</td></tr></tbody></table><b>Entered with Ctrl+Shift+Enter.</b> If entered correctly, Excel will surround with curly braces {}.
<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />

If this is close, then you can use the D3 formula to find the most common item type. You'll need to adjust the formula for your sheets.
 

dad2sdt

New Member
Joined
Oct 24, 2014
Messages
8
Thanks, Eric. I will play around with this over the next day or so and post back with real world data/progress.
 

Forum statistics

Threads
1,082,305
Messages
5,364,401
Members
400,800
Latest member
germanpbv

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top