Wednesday, 7 December 2016

Count and Sum Functions


The most used functions in Excel are the functions that count and sum. You can count and sum based on onecriteria or multiple criteria.

Count

To count the number of cells that contain numbers, use the COUNT function.
Count Function

Countif

To count cells based on one criteria (for example, higher than 9), use the following COUNTIF function.
Countif Function

Countifs

To count cells based on multiple criteria (for example, green and higher than 9), use the following COUNTIFS function.
Countifs Function

Sum

To sum a range of cells, use the SUM function.
Sum Function

Sumif

To sum cells based on one criteria (for example, higher than 9), use the following SUMIF function (two arguments).
Sumif Function, Two Arguments
To sum cells based on one criteria (for example, green), use the following SUMIF function (three arguments, last argument is the range to sum).
Sumif Function, Three Arguments

Sumifs

To sum cells based on multiple criteria (for example, blue and green), use the following SUMIFS function (first argument is the range to sum).
Sumifs Function
General note: in a similar way, you can use the AVERAGEIF and AVERAGEIFS function to average cells based on one or multiple criteria.
Count Text Occurrences

This example teaches you how to count the number of occurrences of text in a range.
1. For example, to count the number of cells that contain exactly star.
Countif Function in Excel, Exactly
2. For example, to count the number of cells that contain exactly star + 1 character. A question mark (?) matches exactly one character.
Countif Function, Question Mark
3. For example, to count the number of cells that contain exactly star + a series of zero or more characters. An asterisk (*) matches a series of zero or more characters.
Countif Function, Asterisk
4. For example, to count the number of cells that contain star in any way. No matter what is before or after star, this function finds all the cells that contain star in any way.
Count All Occurrences
5. For example, to count the number of cells that contain text.
Count Cells That Contain Text

Count Logical Values

Learn how to count the number of cells that contain logical values (TRUE and FALSE) in Excel.
1. For example, to count the number of cells that contain TRUE.
Count TRUE
2. For example, to count the number of cells that contain FALSE.
Count FALSE
3. For example, to count the number of cells that contain TRUE or FALSE.
Count TRUE or FALSE

This example shows you how to count the number of blank and nonblank cells in Excel.
1. The COUNTBLANK function counts the number of blank cells.
CountBlank Function in Excel
2. The COUNTA function counts the number of nonblank cells. COUNTA stands for count all.
CountA Function in Excel
Sumproduct

To calculate the sum of the products of corresponding numbers in one or more ranges, use Excel's powerful SUMPRODUCT function.
1. For example, the SUMPRODUCT function below calculates the total amount spent.
Sumproduct Function in Excel
Note: the SUMPRODUCT function performs this calculation: (2 * 1000) + (4 * 250) + (4 * 100) + (2 * 50) = 3500.
2. The ranges must have the same dimensions or Excel will display the #VALUE! error.
Ranges of Unequal Size
3. The SUMPRODUCT function treats any entries that are not numeric as if they were zeros.
Non Numeric Entries

Logical Functions


Learn how to use Excel's logical functions such as the IF, AND and OR function.

If Function

The IF function checks whether a condition is met, and returns one value if TRUE and another value if FALSE.
1. Select cell C2 and enter the following function.
If Function
The IF function returns Correct because the value in cell A1 is higher than 10.

And Function

The AND Function returns TRUE if all conditions are true and returns FALSE if any of the conditions are false.
1. Select cell D2 and enter the following formula.
And Function
The AND function returns FALSE because the value in cell B2 is not higher than 5. As a result the IF function returns Incorrect.

Or Function

The OR function returns TRUE if any of the conditions are TRUE and returns FALSE if all conditions are false.
1. Select cell E2 and enter the following formula.
Or Function
The OR function returns TRUE because the value in cell A1 is higher than 10. As a result the IF function returns Correct.
General note: the AND and OR function can check up to 255 conditions.

Nested If

The IF function in Excel can be nested, when you have multiple conditions to meet. The FALSE value is being replaced by another If function to make a further test. For example, look at the formula below.
1a. If cell A1 equals 1, the function returns Bad.
First Nested If Formula, Value 1
1b. If cell A1 equals 2, the function returns Good.
First Nested If Formula, Value 2
1c. If cell A1 equals 3, the function returns Excellent.
First Nested If Formula, Value 3
1d. If cell A1 equals another value, the function returns No Valid Score.
First Nested If Formula, Else
Here's another example.
2a. If cell A1 is less or equal to 10, the function returns 350.
Second Nested If Formula, Value 6
2b. If cell A1 is greater than 10 and less or equal to 20, the function returns 700.
Second Nested If Formula, Value 12Second Nested If Formula, Value 20
2c. If cell A1 is greater than 20 and less or equal to 30, the function returns 1400.
Second Nested If Formula, Value 27
2d. If cell A1 is greater than 30, the function returns 2000.
Second Nested If Formula, Else
Note: to slightly change the boundaries, you might want to use "<" instead of "<=" in your own formula.


No comments:

Post a Comment