Counting in Excel Column

ANONYMOUS123456

Board Regular
Joined
Jul 3, 2016
Messages
85
Hello Everyone,
I have an excel column containing some entries. I want to check how many times each entry of the column appears in that whole column.

E.g if the A1 CELL contains "Elephant" and A2 CELL contains "Elephant Rabbit" then the count of "Elephant" in A1 should be 1 considering range A1:A2. But E.g if the A1 CELL contains "Elephant" and A2 CELL also contains "Elephant" then the count of "Elephant" in A1 should be 2 considering range A1:A2 while dragging the formula in B column.

In other words, the contents of cells should be compared wholly not partially. E.g if the A1 CELL contains "Elephant" and A2 CELL contains "Elephant Rabbit" then the count of "Elephant" in A1 should not be 2 considering range A1:A2 just because "Elephant" is existing in A2 as well. The point is cell A2 contains "Elephant" partially and "Rabbit" is also present there in A2.

Regards,
 
Yeah I understand your point of concern. Can you please observe the following pic again and tell me why the formula =SUMPRODUCT(--EXACT($A$1:$A$9,A1) is not calculating properly ?



2pzwepu.png
So? The entire filtered-out row is invisible for the Find-and-Replace but it is still visible for the formula.
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Yeah I understand your point of concern...
No concerns whatsoever.

... Can you please observe the following pic again and tell me why the formula =SUMPRODUCT(--EXACT($A$1:$A$9,A1) is not calculating properly ?
The observed discrepancy between the Find-and-Replace and the formula's result can be caused by a number of factors, for example:
- the range in the formula does not cover your entire data range;
- other "pc < software >" entries have trailing spaces or invisible characters, etc.

Try creating a small mock-up dataset and experimenting with the entries and the formula.
 
Upvote 0
Anony

try if the below works.
=SUMPRODUCT(--(ISNUMBER(FIND(A1,$A$1:$A$9))))
 
Upvote 0
No concerns whatsoever.


The observed discrepancy between the Find-and-Replace and the formula's result can be caused by a number of factors, for example:
- the range in the formula does not cover your entire data range;
- other "pc < software >" entries have trailing spaces or invisible characters, etc.

Try creating a small mock-up dataset and experimenting with the entries and the formula.

Well, I have checked that the formula covers the whole range. I have already trimmed the data so no chance for the trailing spaces. I don't know what do you mean by invisible characters.
 
Upvote 0
... I have already trimmed the data so no chance for the trailing spaces. I don't know what do you mean by invisible characters.
For example, CHAR(160). It is not removed by TRIM() and CLEAN().
Test all your "pc < software >" entries with LENGTH() -- if it's more than 13, than you have invisible characters.
 
Upvote 0
For example, CHAR(160). It is not removed by TRIM() and CLEAN().
Test all your "pc < software >" entries with LENGTH() -- if it's more than 13, than you have invisible characters.

Okay I checked lengths of all entries and they are exactly 13. May be there is any other problem ?
 
Upvote 0
... May be there is any other problem ?
Apparently, there is.

In post #1, you requested that "the contents of cells should be compared wholly not partially."
EXACT() does exactly this. If it returns FALSE, than the two 13-symbol strings are not identical.
Try to figure out what the difference is, for example by getting CODE() for each symbol.
When this is known, a formula can be devised to handle the situation.
 
Upvote 0
COUNTIF(S) and kindred aggregation functions are like MATCH and kindred functions are sensitive to tokens (chars) with special meaning as <, *, etc.

If you are trying to count the occurrences say "software", try rather:

=SUMPRODUCT(--ISNUMBER(SEARCH(D1,$A$1:$A$9)))

where D1 = software.

Note that this counts an entry like <software><software> just once.
 
Upvote 0
COUNTIF(S) and kindred aggregation functions are like MATCH and kindred functions are sensitive to tokens (chars) with special meaning as <, *, etc.

If you are trying to count the occurrences say "software", try rather:

=SUMPRODUCT(--ISNUMBER(SEARCH(D1,$A$1:$A$9)))

where D1 = software.

Note that this counts an entry like <software><software> just once.


Well, I am comparing entire cells with each other. In your example, I want to calculate number of cells which entirely comprise of exactly "software". Your formula calculates, number of cells which contain "software" which could be like "*software*" .
</software></software>
 
Upvote 0
Well, I am comparing entire cells with each other. In your example, I want to calculate number of cells which entirely comprise of exactly "software". Your formula calculates, number of cells which contain "software" which could be like "*software*" .

Change D1 to: |software>

where | stands for the less than sign.<software>

If your intent is still not met after this modification, try to post a small sample here in an Excel readable form (but not an image as you did above).</software>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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