Working on a whole column at once: practice exercises
SUM with LEN, MAX with LEN, MONTH and YEAR on a range, SUMPRODUCT. 5 exercises on real-looking data, each marked the moment you press Check. The first exercise is below to try now; the full lesson is part of Pro.
Text messages are charged by the character. In G1, work out the total number of characters in all the messages in B2:B9, in one formula with LEN and SUM.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Sent to | Message | Total characters | ||||
| 2 | Ella Patel | The lift is out of order today | |||||
| 3 | Will Evans | Fire drill this afternoon | |||||
| 4 | Chen Wilson | The office is closed on Friday | |||||
| 5 | Ella Ahmed | Please complete your timesheet | |||||
| 6 | Ben Baker | Reminder: staff meeting at 9am | |||||
| 7 | Alex Ali | Your appointment is confirmed | |||||
| 8 | Ivan Brown | Training starts at 10am sharp | |||||
| 9 | Jordan Wilson | Your parcel is at reception |
How it works
Functions like LEN, VALUE, MONTH and YEAR normally take one cell. Give them a whole range and they work on every cell at once, giving a list of answers. Wrap that list in SUM, MAX or SUMPRODUCT to get one figure, with no helper column.
A test on a range, like MONTH(B2:B9)=3, gives a list of TRUEs and FALSEs. Put -- in front to turn them into 1s and 0s, then SUM them to count. Multiply by another range to add up only the matching rows.
=SUM(LEN(A2:A6)) =SUM(--(MONTH(B2:B6)=3)) =SUMPRODUCT((YEAR(B2:B6)=2025)*C2:C6)
A whole range in a one-cell function
=LEN(A2) counts the characters in one cell. =LEN(A2:A6) counts them in every cell, giving five answers. On its own that list spills down the sheet. Inside SUM or MAX it becomes one figure:
=SUM(LEN(A2:A6)): all the characters added up.=MAX(LEN(A2:A6)): the longest entry.
The same works for VALUE, MONTH, YEAR, LEFT, SEARCH and most other one-cell functions.
This works as shown in Excel 365 and 2021. In older Excel, enter it as an array formula (Excel then shows { } round it), or use SUMPRODUCT in place of SUM, which works in every version.
Worked example
| A | B | C | |
|---|---|---|---|
| 1 | Name | Start date | Pay (£) |
| 2 | Amira Khan | 03/03/2025 | 1200 |
| 3 | Ben Ode | 17/03/2025 | 950 |
| 4 | Cara Lin | 02/06/2025 | 1100 |
| 5 | Dev Rao | 21/03/2026 | 1300 |
| 6 | Ewa Nowak | 09/11/2026 | 1000 |
=SUM(LEN(A2:A6))in E2. LEN gives 10, 7, 8, 7 and 9 characters. SUM adds them: 41.=SUM(--(MONTH(B2:B6)=3))in E3. MONTH gives 3, 3, 6, 3, 11. The test gives TRUE, TRUE, FALSE, TRUE, FALSE;--makes those 1, 1, 0, 1, 0, so the count of March starters is 3.=SUMPRODUCT((YEAR(B2:B6)=2025)*C2:C6)in E4. Multiplying by the pay keeps the 2025 rows and turns the others into 0, so this adds up the pay of the 2025 starters: 3250.
Why the --?
SUM skips TRUE and FALSE when they come from a range or a list, so =SUM(MONTH(B2:B6)=3) gives 0. A minus sign turns TRUE into -1, and a second one makes it 1. Multiplying by 1, or by another range, does the same job.
SUMPRODUCT is a SUM that always handles lists, which is why you'll often see it used this way in older workbooks.
What you'll practise
- Text messages are charged by the character. In G1, work out the total number of characters in all the messages in B2:B9, in one formula with LEN and SUM.
- Shelf labels can hold a limited number of characters. In G1, find how many characters the longest item name in A2:A13 has, using MAX and LEN.
- In H2, count how many training courses are in the month whose number is in H1 (1 for January). Use MONTH on the whole of B2:B21.
- The amounts in column B came out of a finance system as text, like GBP 12.50, so SUM ignores them. In G1, total them in one formula: SUBSTITUTE to remove GBP, VALUE to make numbers, then SUM.
- In H2, add up the amounts spent in the year in H1. Use YEAR on the whole date column, compare it with H1, and multiply by the amounts inside SUMPRODUCT.
Guides with worked examples: LET: naming a step in a long formula · Count unique values in Excel