Tally/count unknown values that appear in several columns

ocp_zoe

New Member
Joined
Oct 14, 2011
Messages
33
Hello!

I have six columns of values that I need to tally up by appearance.
Some values appear more than once in a column and sometimes in more than one column.
I've playing round in vlookup tutorial but cannot figure this out and would love to learn.

Example:

Column 1 / Column 2 / Column 3
Apples / Oranges / Bananas
Apples / blank / blank
Apples / bananas / blank
Bananas / blank / blank
Oranges / Apples / blank

How do I total the # of appearances of apples (4), oranges (2) and bananas (3)?

The spreadsheet is massive with many values so I'm looking for a way to do so automatically.

Thank you!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
You can use COUNTIF for this.

=COUNTIF(A:C,"Apples") would give you a count of apples

Lets say your data lives in columns A:F and you have what you are trying to tally in cell H2:
=COUNTIF($A:$F,H2)

Hope this helps.
 
Upvote 0
Is there a way to do this without knowing what values are in the columns?
In this example it would be any kind of fruit. I don't want to have to type a COUNTIF for each type of fruit.

Thank you.
 
Upvote 0
You can use the formula in E2 to generate a unique list of values in your columns. Then the COUNTIF can be used to see how many of each one there is.

ABCDEF
1Column 1Column 2Column 3Unique ListCount
2ApplesOrangesBananasApples4
3ApplesOranges2
4ApplesBananasBananas3
5BananasCherriesCherries1
6OrangesApples
7

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

Worksheet Formulas
CellFormula
F2=IF(E2="","",COUNTIF($A$2:$C$10,E2))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
E2{=IF(E1="","",IFERROR(INDIRECT(TEXT(SMALL(IF($A$2:$C$10<>"",IF(COUNTIF($E$1:$E1,$A$2:$C$10)=0,ROW($A$2:$C$10)*100+COLUMN($A$2:$C$10))),1),"R00C00"),0),""))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
Row\Col
A​
B​
C​
D​
E​
F​
G​
1​
ApplesOrangesBananas
3​
2​
ApplesBananas
3​
3​
ApplesbananasOranges
2​
4​
BananasApples
4​
5​
OrangesApples

In F1 control+shift+enter, not just enter:

=SUM(IF(A1:C5<>"",1/COUNTIFS(A1:C5,A1:C5)))

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

=IF(ROWS(F$2:F2)>$F$1,"",LOOKUP(REPT("z",255),INDEX(IF(COUNTIFS(F$1:F1,A$1:C$5&""),0,A$1:C$5&""),MIN(IF(COUNTIFS(F$1:F1,A$1:C$5&""),"",ROW(A$1:C$5)-ROW(A$1)+1)),0)))

In G2 just enter and copy down:

=IF($F2="","",COUNTIFS(A$1:C$5,$F2))
 
Upvote 0
Row\Col
A​
B​
C​
D​
E​
F​
G​
1​
ApplesOrangesBananas
3​
2​
ApplesBananas
3​
3​
ApplesbananasOranges
2​
4​
BananasApples
4​
5​
OrangesApples

In F1 control+shift+enter, not just enter:

=SUM(IF(A1:C5<>"",1/COUNTIFS(A1:C5,A1:C5)))

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

=IF(ROWS(F$2:F2)>$F$1,"",LOOKUP(REPT("z",255),INDEX(IF(COUNTIFS(F$1:F1,A$1:C$5&""),0,A$1:C$5&""),MIN(IF(COUNTIFS(F$1:F1,A$1:C$5&""),"",ROW(A$1:C$5)-ROW(A$1)+1)),0)))

In G2 just enter and copy down:

=IF($F2="","",COUNTIFS(A$1:C$5,$F2))

We need to remove the &"" bit from the formula in F2, so that...

=IF(ROWS(F$2:F2)>$F$1,"",LOOKUP(REPT("z",255),INDEX(IF(COUNTIFS(F$1:F1,A$1:C$5),0,A$1:C$5),MIN(IF(COUNTIFS(F$1:F1,A$1:C$5),"",ROW(A$1:C$5)-ROW(A$1)+1)),0)))

Oyherwise, we probably won't get Cherries Eric puts in the input.:rolleyes:
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,612
Members
449,238
Latest member
wcbyers

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