|
⇤ ← Revision 1 as of 2022-03-09 15:13:25
Size: 1491
Comment:
|
← Revision 2 as of 2025-04-08 16:51:34 ⇥
Size: 1298
Comment: Standardize
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| The '''COUNTIF''' and '''COUNTIFS''' functions are used to aggregate data as counts. | The '''`COUNTIF`''' and '''`COUNTIFS`''' functions are used to aggregate data as counts. |
| Line 13: | Line 13: |
| Consider the below spreadsheet: | Given the below worksheet: |
| Line 23: | Line 23: |
| To count the number of students with scores below 85, use the '''COUNTIF''' function like: | Try: |
| Line 37: | Line 37: |
| * Question marks and asterisks are treated as [[Excel/SearchQueries#Wildcards|wildcard characters]] | * Question marks and asterisks are treated as [[Excel/FindReplace#Wildcards|wildcard characters]] |
| Line 45: | Line 45: |
| To count the number of students with scores below 85 and no sick days, use the '''COUNTIFS''' function like: | Try: |
| Line 51: | Line 51: |
| Every range must have the same number of rows and columns. Otherwise a `#VALUE!` error propogates. | Every range must have the same number of rows and columns. Otherwise a `#VALUE!` error propagates. |
Excel CountIf
The COUNTIF and COUNTIFS functions are used to aggregate data as counts.
Contents
COUNTIF
Given the below worksheet:
|
A |
B |
C |
1 |
Name |
Score |
Days Sick |
2 |
Alice |
91 |
0 |
3 |
Bob |
54 |
7 |
4 |
Charlie |
87 |
2 |
5 |
Daisy |
84 |
0 |
6 |
Edward |
76 |
1 |
Try:
=COUNTIF($B:$B, "<85")
The second parameter is called the criteria. A criteria can be any of:
An integer literal (32)
A string expressing a logical comparison (">32")
A cell (B4)
To use a logical comparison with a cell's value, try string concatenation (">" & B4)
A string literal ("apples")
Integers can also be expressed as string literals due to duck typing ("32")
Question marks and asterisks are treated as wildcard characters
COUNTIFS
Try:
=COUNTIFS($B:$B, "<85", $C:$C, 0)
Every range must have the same number of rows and columns. Otherwise a #VALUE! error propagates.
