BajanPaul
asked on
Ms Excel: How to count different variations of text
Good morning Excel Gurus,
I want to know if there is a custom function i could use to count variations in text. For example I have a set of numbers in one column and in column two the definition of the numbers. so for example.
1 Reason abc
1 Reason def
1 Reason abc
1 Reason hij
1 Reason abc
So my count of Reason abc = 3, def = 1, hij=1
For number 1=3 distinct reasons
I know I could throw into a pivot table and count this way. I was hoping to be able to use a function to accomplish the same task.
Thanks
PS
OptxtExample.xlsx
I want to know if there is a custom function i could use to count variations in text. For example I have a set of numbers in one column and in column two the definition of the numbers. so for example.
1 Reason abc
1 Reason def
1 Reason abc
1 Reason hij
1 Reason abc
So my count of Reason abc = 3, def = 1, hij=1
For number 1=3 distinct reasons
I know I could throw into a pivot table and count this way. I was hoping to be able to use a function to accomplish the same task.
Thanks
PS
OptxtExample.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK, so if I am understanding, you have a list of numbers, and you want to find out how many times each individual number appears in the list. One way to do something like this would be with what I used to call an 'array' function.
Let us say that in cells A1:A500, you want to count how many times the number '344' appears. You could use a formula such as this:
=SUM(IF($A$1:$A$500=344,1, 0))
IMPORTANT NOTE! When entering this formula, you MUST hit CTRL+SHIFT+ENTER, not just ENTER. This tells Excel that the function you are entering is an array function (referencing an array of cells). You will know if you entered it correctly by clicking on the cell containing the formula and looking at the formula bar. The formula will look like this in the formula bar:
{=SUM(IF($A$1:$A$500=344,1 ,0))}
The brackets signify that it is an array function. You cannot type the brackets, you must use CTRL+SHIFT+ENTER to force Excel to do this.
Let us say that in cells A1:A500, you want to count how many times the number '344' appears. You could use a formula such as this:
=SUM(IF($A$1:$A$500=344,1,
IMPORTANT NOTE! When entering this formula, you MUST hit CTRL+SHIFT+ENTER, not just ENTER. This tells Excel that the function you are entering is an array function (referencing an array of cells). You will know if you entered it correctly by clicking on the cell containing the formula and looking at the formula bar. The formula will look like this in the formula bar:
{=SUM(IF($A$1:$A$500=344,1
The brackets signify that it is an array function. You cannot type the brackets, you must use CTRL+SHIFT+ENTER to force Excel to do this.
Explanation: The array forumula cycles through the array of cells, and utilizing the IF statement, interprets each cell containg the number you are looking for as a value of "1", and each of the non-matching cells as a value of "0". The SUM function then adds up all of the 1's and 0's, giving you your count.
ASKER
Gents,
I appreciate the feedback. I chose to use excels remove duplicates function and then passed the data into an excel pivot for the counts.
THanks
I appreciate the feedback. I chose to use excels remove duplicates function and then passed the data into an excel pivot for the counts.
THanks
ASKER
So for example:
Num DistinctTxtCounts
1 136
2 154
3 29
4 18
11 34