Let's look at a simple example of what she wanted.

Here though the users have been told to use just the standard term, using lower case throughout. So the field only contains one of three possible values with a fourth value perhaps being an empty field.
Here's a simple solution. There are other solutions more complicated but more elegant in that they don't require the use of any extra cells in the spreadsheet. Again perhaps a future entry will look at these (there's more than one way to skin this particular cat as there are in most forms of computing!)

The solution uses the if statement which follows this syntax form
=if(argument being tested, value if true, value if false)
The equals sign ( = ) is necessary before the if so that Excel recognises that what follows is a formula and not a piece of text.
The argument being tested here is does the value of cell A2 equal the text within the quotes - ie red?
It does so the argument is true, therefore the value if true part of the formula is used which in this case is a numerical 1. Note that if we had wanted a text value we could have used quotes and text messagea as the value if true and value if false
e.g.: =if(A2="red","A red lover!", "What's wrong with red?")
I needed to type in the formula for the first row only. After that I selected those three cells and used the click and drag technique to copy them down the columns. Excel is clever enough to know that if you copy in this way it will amend the formula for each row to calculate from that row - instead of every row calculating using the value in the first row.
All we need to do now is add up each column for our summary. We could put a count at the bottom of each column and then use that or we could use the sum formula like this:

0 Komentar untuk "Excel - Counting Occurrence of Text Values"