Business Analytics & Data Science

B03 · Introductory

Excel for Business Analytics

10 lessons

B03 · Module 1, lesson 2 · Lesson 2 of 10

Functions, logic, text and dates

Excel’s built-in functions do the heavy lifting: counting exactly what you mean, rounding by a business rule, making decisions with IF, taking text apart and joining it, and calculating with dates. Learn how each one works, where each one trips people up, and how to handle errors without hiding them.

About 65 minutes

Before you start

You will be able to

  • Write functions with the right syntax, arguments and nesting, and choose between SUM, AVERAGE, MIN, MAX, COUNT, COUNTA and COUNTBLANK by exactly what each counts.
  • Choose between ROUND, ROUNDUP, ROUNDDOWN, INT and MROUND to round by a business rule, and explain the choice.
  • Build decisions with IF, nested IF, IFS, AND, OR and NOT, putting the conditions in the right order.
  • Use IFERROR and IFNA to handle the errors you expect without hiding the ones you don’t.
  • Use LEFT, RIGHT, MID, LEN, FIND, SEARCH, TRIM, SUBSTITUTE, TEXT and the & operator to split, clean and join text.
  • Calculate with dates using DATE, YEAR, MONTH, DAY, EOMONTH, EDATE, WEEKDAY and NETWORKDAYS.

Review first

Fictional case A fictional coffee business founded by Ana Lim. It starts as a catering and barista-training service, opens its own cafés and an online shop for beans, and plans a canned cold brew.

The idea

Fictional case

Ana’s next questions about the spring orders are small but exact. Does every subscription order carry exactly the 10% discount Lantern promises? How many orders were rated, and what was the average rating? Which month, and which day of the week, was each order placed on? And can she sort the orders by the number inside their IDs, such as the 10144 in LC-10144?

Each question needs a function: one of Excel’s built-in calculations, called by name.

What a function is

A function is a named calculation that Excel already knows. You call it inside a formula by its name followed by parentheses holding its arguments, the values it works on, separated by commas: =SUM(J2:J232) adds 231 cells, and =ROUND(J2,0) rounds J2 to a whole number. Microsoft writes each function’s syntax with the optional arguments in square brackets, as in WEEKDAY(serial_number,[return_type]), so you can leave the second one out. An argument can be a value, a reference, a range or another function.

Putting one function inside another is nesting: in =ROUND(AVERAGE(M2:M232),2) the average is calculated first and then rounded. Microsoft’s limits are 255 arguments to a function and 64 levels of nesting, far more than a readable formula should use. To find a function, start typing its name after an equals sign, or use Insert Function (Shift+F3); AutoSum (Alt+= in Windows, Shift+Command+T on a Mac) inserts a SUM formula for you to check and confirm.

Counting exactly what you mean

SUM, AVERAGE, MIN and MAX work on the numbers in a range. The three counting functions differ in exactly what they count, and the difference matters whenever a column has gaps or text in it.

What each counting function counts when the cell is in a range (Microsoft’s function pages)
A cell holding …COUNTCOUNTACOUNTBLANK
A number or a dateYesYesNo
ZeroYesYesNo
TextNoYesNo
TRUE or FALSENoYesNo
An error valueNoYesNo
A formula that returns "" (empty text)NoYesYes
Nothing at allNoNoYes

Lantern’s rating column (M) is a good test. Customers rated 154 of the 231 orders, and the other 77 cells are empty. =COUNT(M2:M232) returns 154, =COUNTBLANK(M2:M232) returns 77, and =COUNTA(A2:A232), on the order IDs, returns 231. AVERAGE skips empty cells, text and logical values in a range but includes zeros, so =AVERAGE(M2:M232) is 632÷154≈4.10632 \div 154 \approx 4.10, the average of the ratings actually given. Had someone typed 0 into the unrated cells, the same formula would return 632÷231≈2.74632 \div 231 \approx 2.74: a blank means “no answer”, a 0 is an answer.

Rounding by a rule

The previous lesson separated formatting, which changes the display, from rounding, which changes the stored value. Excel has a rounding function for each business rule:

Rounding functions (the ROUND, INT and MROUND examples are Microsoft’s)
FunctionRuleExamples
ROUND(number,num_digits)To the nearest, halves away from zero; negative digits round to the left of the point=ROUND(2.15,1) is 2.2; =ROUND(-1.475,2) is −1.48; =ROUND(21.5,-1) is 20
ROUNDUP(number,num_digits)Always away from zero=ROUNDUP(3.2,0) is 4
ROUNDDOWN(number,num_digits)Always towards zero=ROUNDDOWN(3.2,0) is 3
INT(number)Down to the next whole number, so negatives move away from zero=INT(8.9) is 8; =INT(-8.9) is −9
MROUND(number,multiple)To the nearest multiple; both arguments must have the same sign=MROUND(10,3) is 9; =MROUND(1.3,0.2) is 1.4; =MROUND(5,-2) is #NUM!

Choose by asking what happens in the business. Money that changes hands is rounded to the cent with ROUND. Things that come in whole units are rounded up if you need enough of them: a breakfast for 45 guests with one pastry box per 12 guests needs =ROUNDUP(45/12,0), 4 boxes, because 3.75 boxes can’t be bought, and ROUND would also give 4 here only by luck (50 guests need 5, while ROUND gives 4). Whole units you can make from stock are rounded down with ROUNDDOWN or INT. Prices set to the nearest 5 cents use MROUND: a 6% rise takes $15.50 to $16.43, and =MROUND(16.43,0.05) gives $16.45.

In depth

Logical tests and IF

A comparison such as =J2>=50 returns a logical value, TRUE or FALSE. IF turns that into a decision: IF(logical_test,value_if_true,value_if_false) returns its second argument when the test is TRUE and its third when it is FALSE. Text arguments go in double quotation marks; without them Excel looks for a name and returns #NAME?. Numbers go without quotes.

Lantern promises subscribers 10% off. With the rate in an input cell P1 (10%), the discount a subscription order should carry is =IF(L2="yes",ROUND(G2*H2*$P$1,2),0): if the subscription column says yes, 10% of quantity times price, rounded to the cent; otherwise nothing. Comparing that with the recorded discount in column I tests the promise row by row, and the simple example does it.

AND, OR and NOT combine tests. AND(test1,test2,…) is TRUE only when every test is TRUE; OR(…) is TRUE when at least one is; NOT(test) reverses a test. Microsoft allows up to 255 conditions, and notes that AND ignores text and empty cells inside a range argument and returns #VALUE! if it finds no logical values at all. A flag for orders that need checking is then =IF(AND(L2="yes",I2<>N2),"check","ok"): a subscription order whose recorded discount differs from the expected one in N2.

Comparisons with = ignore letter case: ="Yes"="yes" returns TRUE (try it). Microsoft describes EXACT as the case-sensitive test, for when case matters. Lantern’s subscription column is all lower case, so the question doesn’t arise, but data typed by people often isn’t.

Comparisons don’t convert text, either: ="10"=10 is FALSE, and an order total stored as the text “$58.00” passes =J2>=75, because Excel ranks text above numbers in a comparison. Convert such values to numbers first, as B02 showed, before a formula makes decisions with them.

Several outcomes: nested IF and IFS

For more than two outcomes, put an IF in the false branch of another. For the packing rota, Ana flags orders of $75 or more “large”, $25 or more “medium”, and the rest “small” (packing labels, not the $20, $40 and $100 order-size bands she reports with, which Module 2 looks up from a table): =IF(J2>=75,"large",IF(J2>=25,"medium","small")). Excel stops at the first test that is TRUE, so the order of the tests is part of the logic. Test the $25 threshold first and a $111 order is labelled “medium”, because 111 ≥ 25 is TRUE before the $75 test is ever reached. Microsoft makes the same point with a commission example, and warns that, although Excel allows 64 nested IFs, such formulas are hard to get right and harder to maintain.

IFS lists the tests and their results in pairs: =IFS(J2>=75,"large",J2>=25,"medium",TRUE,"small"). It is available in Excel 2019, 2021 and 2024 and in Microsoft 365, and takes up to 127 conditions. If no test is TRUE, IFS returns #N/A, so the last test is usually TRUE, a catch-all. Two habits help with either form: put the thresholds in input cells rather than in the formula, and when the bands multiply, use a lookup table, which Module 2 builds with an approximate-match lookup.

Errors you expect and errors you don’t

IFERROR(value,value_if_error) returns the value unless it is an error, in which case it returns the second argument. It catches every error type: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? and #NULL!. IFNA(value,value_if_na) catches only #N/A, the error a lookup returns when a key is missing; IFNA was added in Excel 2013.

That breadth is the danger. Suppose a cell works out each channel’s average order value as =IFERROR(B2/C2,0), so that a channel with no orders shows 0 rather than #DIV/0!. If someone later deletes a column the formula used, or mistypes a reference, the #REF! or #NAME? that should have shouted is also turned into 0, and 0 looks like a real result. Microsoft’s page on #DIV/0! errors makes the same point: IFERROR suppresses every error, so check that a formula works before you add error handling. Test for the case you expect instead, =IF(C2=0,"",B2/C2), and keep IFNA for lookups, where #N/A is the expected error.

Taking text apart

A piece of text in a cell is a text string, and its characters are numbered from 1. LEFT and RIGHT take characters from either end, MID takes them from a given position, and LEN counts them. For LC-10001 in A2, =LEFT(A2,2) is “LC”, =MID(A2,4,5) is “10001” and =LEN(A2) is 8.

The order ID LC-10001 as a text string. Characters are numbered from 1; LEFT, MID and RIGHT take characters by position, FIND returns the position of the first hyphen, and LEN counts all eight characters.

FIND and SEARCH return the position of one string inside another, which lets a formula cope with text of different lengths: =MID(A2,FIND("-",A2)+1,LEN(A2)) returns everything after the first hyphen, however long the prefix. The two differ in a way that matters. FIND is case-sensitive and doesn’t allow wildcards; SEARCH ignores case and allows them (the next lesson explains wildcards). Microsoft’s example: in “Miriam McGovern”, =FIND("M",A2) is 1 but =FIND("m",A2) is 6. If the text isn’t found, both return #VALUE!.

The results of LEFT, MID and RIGHT are text, even when they look like numbers. “10001” sorts as text and SUM skips it. =VALUE(MID(A2,4,5)) converts it to the number 10001; Microsoft’s VALUE accepts any number, date or time format Excel recognises, so =VALUE("$1,000") is 1000. An arithmetic operator converts too, which is why =--RIGHT(A2,5) (minus minus) also works.

Cleaning and joining text

UPPER, LOWER and PROPER change letter case: =PROPER("hOUSE bLEND") is “House Blend”. TRIM removes spaces from the ends of a string and reduces runs of spaces inside it to one, but Microsoft warns that it removes only the ordinary space character (code 32), not the non-breaking space (code 160) that web pages and exports often contain; B02’s lesson on text showed how to find those. SUBSTITUTE(text,old_text,new_text) replaces one string with another: =SUBSTITUTE(A2,"LC-","") leaves “10001”. The full cleaning workflow, on Lantern’s raw export, is in the next module.

The & operator joins text: =A2&" ("&L2&")" gives “LC-10001 (no)” for the first order. Joining is called concatenation. CONCAT does the same for a list of values or ranges, and replaces the older CONCATENATE, which stays for compatibility. TEXTJOIN adds a delimiter between the pieces and can skip empty cells: =TEXTJOIN(", ",TRUE,D2:D6). Both are available in Excel 2019 and later and in Microsoft 365, and both return #VALUE! if the result would exceed a cell’s 32,767 characters.

TEXT formats a number as text: =TEXT(J2,"$#,##0.00") gives “$111.00” and =TEXT(B2,"mmmm") gives “March”. The result is text, which is exactly what you want in a label and exactly what you don’t want in a calculation. Microsoft’s advice is to keep the original value in one cell and use TEXT in another.

Dates are numbers

As B02 showed, Excel stores a date as a serial date: in the default 1900 date system, 1 January 1900 is 1, and Lantern’s first order day, 1 March 2026, is 46082. Because dates are numbers, subtracting one from another gives a number of days, and adding 7 gives the same weekday a week later. Excel treats 1900 as a leap year, which it wasn’t, for compatibility with Lotus 1-2-3; the only consequence Microsoft lists is that WEEKDAY is wrong for dates before 1 March 1900.

Date functions, applied to LC-10001’s order date (1 March 2026) in B2
FormulaReturnsWhat it does
=DATE(2026,3,1)46082Builds a date from a year, month and day; months above 12 and days past the month’s end roll forward
=YEAR(B2), =MONTH(B2), =DAY(B2)2026, 3, 1Take a date apart
=TEXT(B2,"mmmm")MarchA month name, as text (“mmm” gives Mar)
=EOMONTH(B2,0)46112 (31 March 2026)The last day of the month, 0 months on; =EOMONTH(B2,-1)+1 is the first day of the month
=EDATE(B2,1)46113 (1 April 2026)The same day of the month, one month later
=WEEKDAY(B2)1Day of the week, 1 (Sunday) to 7 (Saturday); 1 March 2026 was a Sunday
=WEEKDAY(B2,2)7With return type 2, 1 (Monday) to 7 (Sunday)
=NETWORKDAYS(B2,EOMONTH(B2,0))22Whole working days (Monday to Friday) from the order to the month’s end, both dates counted

DATE rolls over in Microsoft’s documented way: =DATE(2008,14,2) is 2 February 2009 and =DATE(2008,1,35) is 4 February 2008, which makes month arithmetic safe. Microsoft also advises four-digit years, because DATE adds 1900 to a year from 0 to 1899. NETWORKDAYS takes an optional list of holidays as a third argument, and NETWORKDAYS.INTL handles weekends other than Saturday and Sunday. A month is not 30 days: =B2+30 lands on 31 March, while =EDATE(B2,1) lands on 1 April, which is the date a monthly subscription actually renews. A date stored as text in a format Excel recognises (“March 2, 2026” is one with US settings) is turned into a serial number with DATEVALUE; the next module uses it, with the day-and-month caution from B02, on Lantern’s raw export.

You may meet DATEDIF, which counts complete years, months or days between two dates: =DATEDIF(B2,C2,"M"). Microsoft keeps it to support old Lotus 1-2-3 workbooks, warns that it “may calculate incorrect results under certain scenarios”, advises against its “MD” unit, and notes that it returns #NUM! when the start date is after the end date. For days, subtract the dates; for months, prefer a formula you can check.

Formulas

Expected subscription discount

d=round⁡(r×q×p, 2) if a subscription order, otherwise 0d = \operatorname{round}(r \times q \times p,\ 2) \text{ if a subscription order, otherwise } 0
dd
The discount the order should carry$
rr
The subscription discount rate (10% at Lantern)
qq
Quantityitems
pp
Unit price$ per item

In Excel: =IF(L2="yes",ROUND(G2*H2*$P$1,2),0), with the rate in P1.

Whole units needed

n=⌈gk⌉n = \left\lceil \dfrac{g}{k} \right\rceil
nn
Units to buy, rounded up to a whole numberunits
gg
What has to be covered, such as guestsguests
kk
How much one unit covers, such as guests per pastry boxguests per unit

The brackets ⌈ ⌉ mean “round up”. In Excel: =ROUNDUP(B2/12,0).

Lantern’s catering quote (one-day event)

Q=max⁡(M, S+a g+b h+P x)Q = \max\left(M,\ S + a\,g + b\,h + P\,x\right)
QQ
The quoted price$
MM
The minimum invoice$
SS
The setup charge for the day$
aa
The price per guest$ per guest
gg
Number of guestsguests
bb
The charge per hour of service$ per hour
hh
Hours of servicehours
PP
The pastry platter charge$
xx
1 if the client wants pastries, 0 if not

Assumes. Ana’s quote sheet (fictional). Invoices can differ from the quote by bespoke changes.

In Excel, with the five inputs in B1:B5: =MAX($B$5,$B$1+$B$2*B9+$B$3*C9+IF(D9="yes",$B$4,0)).

Worked examples

A first example: Checking the subscription discounts

Fictional figures

Lantern promises subscribers 10% off. P1 holds 10%. For the first six orders, work out in column N the discount each order should carry, and flag in column O any subscription order whose recorded discount (column I) differs.

The first six orders (G quantity, H unit price, I discount, L subscription)
OrderGHILN: expected
LC-100012$58.00$5.00no$0.00
LC-100022$17.00$3.40yes$3.40
LC-100031$14.00$0.00no$0.00
LC-100043$14.00$5.00no$0.00
LC-100052$46.00$0.00no$0.00
LC-100061$14.00$1.40yes$1.40
  1. Write the rule as a decision: if the order is a subscription, 10% of quantity × price, rounded to the cent; otherwise 0. In N2: =IF(L2="yes",ROUND(G2*H2*$P$1,2),0). The rate reference is absolute so that it survives being filled down.
  2. Fill down. LC-10002 is a subscription: 2×17×0.10=3.402 \times 17 \times 0.10 = 3.40, which equals its recorded discount. LC-10006: 1×14×0.10=1.401 \times 14 \times 0.10 = 1.40, also equal. The other four are not subscriptions, so N shows $0.00.
  3. Flag only what matters. In O2: =IF(AND(L2="yes",I2<>N2),"check","ok"). LC-10001 and LC-10004 carry a $5.00 discount that N doesn’t expect, but they aren’t subscriptions: their discount is a promotion code, so the AND keeps them out of the flag.
  4. Count the flags with the next lesson’s COUNTIF, or for now look down the column: every row shows “ok”.

Answer. N2 holds =IF(L2="yes",ROUND(G2*H2*$P$1,2),0) and O2 =IF(AND(L2="yes",I2<>N2),"check","ok"); for these six orders every flag reads “ok”.

What it means. Filled down all 231 rows, the flag finds no subscription order with the wrong discount: all 104 carry exactly 10%. Without the AND, every promotion-code order would be flagged and the real exceptions, had there been any, would be lost among them.

A first example: Taking an order apart: its ID and its date

Fictional figures

The bulk office order is LC-10144 (A2), placed on 14 May 2026 (B2). Ana wants its number as a number, its month name, its day of the week, and the working days left in the month after it arrived.

  1. The number: =MID(A2,4,5) returns the text “10144”, which won’t sort with numbers; =VALUE(MID(A2,4,5)) returns the number 10144. If prefixes vary in length, find the hyphen first: =VALUE(MID(A2,FIND("-",A2)+1,LEN(A2))).
  2. The month: B2 holds the serial number 46156. =MONTH(B2) is 5 and =TEXT(B2,"mmmm") is “May”.
  3. The day of the week: =WEEKDAY(B2) is 5 (counting from Sunday = 1), so the order came on a Thursday; =WEEKDAY(B2,2) is 4 (Monday = 1).
  4. The working days: =EOMONTH(B2,0) is 31 May 2026, and =NETWORKDAYS(B2,EOMONTH(B2,0)) counts Monday to Friday from 14 to 31 May, both ends included: 12. A list of holiday dates as a third argument would remove any that fall in the period.

Answer. Order number 10144 (a number), month “May”, a Thursday (WEEKDAY 5, or 4 with return type 2), and 12 working days to the end of May.

What it means. Each answer came from a function that reads the cell, so the same four formulas, filled down, describe all 231 orders. The order number can now be sorted and compared, and the weekday and month are ready to be counted and summed by the conditional functions in the next lesson.

A harder example: Labelling order sizes: why the order of the tests matters

Fictional figures

For the packing rota (these are not her reporting bands), Ana flags each order “large” ($75 or more), “medium” ($25 or more) or “small”. Write the label for the first eight orders with a nested IF and with IFS, and explain what goes wrong if the tests are reversed or a boundary is mis-stated.

The first eight order totals and their labels
OrderJ: order_totalN: label
LC-10001$111.00large
LC-10002$30.60medium
LC-10003$14.00small
LC-10004$37.00medium
LC-10005$92.00large
LC-10006$12.60small
LC-10007$53.00medium
LC-10008$19.50small
  1. Order the tests from the most demanding: a total that passes the $75 test is large and must never reach the $25 test. Nested IF: =IF(J2>=75,"large",IF(J2>=25,"medium","small")). IFS: =IFS(J2>=75,"large",J2>=25,"medium",TRUE,"small"); without the final TRUE,"small", small orders would show #N/A.
  2. Fill down. LC-10001 ($111.00) and LC-10005 ($92.00) are large; LC-10002, LC-10004 and LC-10007 ($30.60, $37.00, $53.00) are medium; the other three are small.
  3. Reverse the tests and see it fail: =IF(J2>=25,"medium",IF(J2>=75,"large","small")) labels LC-10001 “medium”, because 111 ≥ 25 is TRUE and Excel stops at the first TRUE test. The large label can never be reached.
  4. Check the boundaries. The rule says “$75 or more”, so the test is >=75; with >75 an order of exactly $75.00 would be labelled medium. None of these eight sits on a boundary, which is exactly why boundary errors survive casual checking: test the formula with 75 and 25 typed into a spare cell.
  5. Make the thresholds inputs: with 75 in Q1 and 25 in Q2, =IF(J2>=$Q$1,"large",IF(J2>=$Q$2,"medium","small")) lets Ana change a band without editing 231 formulas.

Answer. Large: LC-10001 and LC-10005; medium: LC-10002, LC-10004 and LC-10007; small: LC-10003, LC-10006 and LC-10008. The tests must run from the highest threshold down, with >= at each boundary.

What it means. A nested IF is a sequence of questions, and the sequence is part of the rule. Two or three bands are fine in IF or IFS; for more, a sorted table of thresholds and an approximate-match lookup (Module 2) is easier to read and to change.

Applied: a business decision: Ana’s catering quote

Fictional figures

Ana prices catering from a quote sheet: a setup charge of $60 for the day, $6.50 per guest, $30 per hour of service, $120 for a pastry platter if wanted, and a minimum invoice of $300. The five figures sit in B1:B5. Three requests for September have arrived (rows 9 to 11: guests in B, hours in C, pastries yes or no in D, event date in E). Build the quote in F and the day of the week in G.

The three requests (fictional)
RowClientB: guestsC: hoursD: pastriesE: date
9Wrenmere Insurance403yes15 September 2026
10Tansymoor Books182no18 September 2026
11Corrandale Clinic1205yes26 September 2026
  1. Build the price from its parts: $B$1+$B$2*B9+$B$3*C9+IF(D9="yes",$B$4,0). The IF adds the platter only when it was asked for; every input reference is absolute because all three rows share the inputs.
  2. Apply the minimum with MAX, which returns the larger of its arguments: =MAX($B$5,$B$1+$B$2*B9+$B$3*C9+IF(D9="yes",$B$4,0)). Using MAX for a floor is shorter and clearer than an IF that repeats the whole calculation.
  3. Fill down. Wrenmere Insurance: 60+6.5×40+30×3+120=53060 + 6.5 \times 40 + 30 \times 3 + 120 = 530. Tansymoor Books: 60+6.5×18+30×2=23760 + 6.5 \times 18 + 30 \times 2 = 237, below the minimum, so the quote is $300. Corrandale Clinic: 60+6.5×120+30×5+120=1,11060 + 6.5 \times 120 + 30 \times 5 + 120 = 1,110.
  4. The day of the week, for the staffing rota: =TEXT(E9,"dddd") gives Tuesday, Friday and Saturday for the three dates.

Answer. Quotes of $530, $300 and $1,110; the events fall on a Tuesday, a Friday and a Saturday.

What it means. The minimum earns its keep on the small meeting: the formula would otherwise quote $237 for a job that still needs the van, a barista and setting up. Because every price is a formula on five labelled inputs, Ana can change the price per guest once and requote all three. Her invoices then add bespoke changes, so they don’t always equal the quote.

Explore

Lantern’s first twelve orders. Try, in turn, in I2 and filled down: =IF(G2="yes",ROUND(C2*D2*$K$1,2),0) (the expected subscription discount), =VALUE(MID(A2,4,5)), =TEXT(B2,"mmm"), =WEEKDAY(B2,2) and =EDATE(B2,1). Then, in a spare cell, compare =COUNT(H2:H13), =COUNTA(H2:H13), =COUNTBLANK(H2:H13) and =AVERAGE(H2:H13) on the ratings. Show formulas reveals what each cell holds.

Loading the interactive…

Common mistakes

  • “COUNT counts the entries in a column.”

    COUNT counts numbers (and dates) only. COUNTA counts every cell that isn’t empty, text and errors included, and COUNTBLANK counts empty cells and formulas that return "". Choose by what the column holds: COUNTA for IDs, COUNT for ratings stored as numbers.

  • “The tests in a nested IF can go in any order.”

    Excel stops at the first TRUE test. Test $25 before $75 and nothing is ever “large”. Order the tests from the most demanding to the least, and check each boundary (≥ or >) against the business rule.

  • “IFERROR makes a sheet safer.”

    IFERROR turns every error into the value you give it, including the #REF! and #NAME? that signal a broken formula. Test for the case you expect, such as a zero divisor with IF, and use IFNA where #N/A is the only expected error.

  • “LEFT, MID and RIGHT of a number give a number.”

    They return text: “10001”, not 10001. Text sorts differently, and SUM skips it. Wrap the result in VALUE, or use an arithmetic operator, when you need the number.

  • “A month is 30 days.”

    =B2+30 lands on different days of the month as month lengths change. Use EDATE for “the same day next month” and EOMONTH for “the end of the month”.

  • “TEXT is just a way to format a number.”

    TEXT returns text, which looks right in a label but no longer behaves as a number or a date. Keep the value in its own cell and use TEXT only where you need words.

Guided practice

Work through these with hints when you need them. Every hint and every worked solution is there to be used.

Loading four questions…

On your own

No hints this time. Answer, check, and read the feedback; the solution appears once you have answered or if you ask for it. Your first answers count toward mastery.

Loading six questions…

In practice

Auditing a promise. With the expected discount and the flag filled down all 231 rows, Ana can tell Lantern’s owner that every one of the 104 subscription orders carried exactly 10% off, and that the other discounts are the $5 promotion code and the bulk order’s negotiated 10%. The check takes two formulas and will run again unchanged on July’s orders. If Lantern ever changes the rate, the input cell changes and every expected discount follows.

What the ratings say. 154 of 231 orders were rated, a response rate of 66.7%, and the average rating given was 4.10. Ana reports both numbers together, using COUNT for the rated orders and AVERAGE for the mean, because an average of ratings means little without the share of customers who gave one. She notes that the unrated orders are blanks, not zeros, so they don’t drag the average down.

Fictional case

Oakridge Fitness, a fictional gym, keeps member records with a member ID such as OKF-2291-M, a joining date and a monthly plan. Its manager uses EDATE to show each member’s next payment date, =IF(AND(D2="active",E2<=$H$1+7),"remind","") to list active members whose payment falls within a week of the report date in H1, and =RIGHT(A2,1) to read the plan letter at the end of the ID. When the gym added a plan with a two-letter code, the RIGHT formula silently started returning half of it; the manager replaced it with a formula that reads everything after the last hyphen, and added a check that counts IDs whose plan code isn’t on the list of plans.

Error handling. A sensible house rule: allow IFERROR only where a specific error is expected and documented, with a note beside it saying which. The reason is the one in this lesson: a hidden #REF! is worse than a visible one, because the number that replaces it looks like an answer.

Knowledge check

Six questions, one attempt each, no hints. Score 80% or more to complete the lesson; you can take it again at any time.

Loading six questions…

Summary

  • A function is called by name with its arguments in parentheses; optional arguments are shown in square brackets, and functions can be nested.
  • COUNT counts numbers, COUNTA counts every non-empty cell, COUNTBLANK counts empty cells and empty text; AVERAGE skips blanks and text but includes zeros, so a blank and a 0 mean different things.
  • Round by the business rule: ROUND for money, ROUNDUP for whole units you must have enough of, ROUNDDOWN or INT for what you can make, MROUND to a multiple.
  • IF makes a decision; AND, OR and NOT combine tests. In nested IF and IFS the first TRUE test wins, so order tests from the most demanding and check each boundary; IFS needs a final TRUE as a catch-all.
  • IFERROR hides every error, including the ones that mean the formula is broken; test for the case you expect, and keep IFNA for lookups.
  • LEFT, RIGHT, MID, LEN, FIND and SEARCH take text apart (FIND is case-sensitive, SEARCH isn’t); their results are text until VALUE converts them. TRIM, PROPER and SUBSTITUTE clean; &, CONCAT and TEXTJOIN join; TEXT formats as text.
  • Dates are serial numbers: DATE builds them, YEAR, MONTH and DAY take them apart, EOMONTH and EDATE move by months, WEEKDAY and NETWORKDAYS handle days of the week. DATEDIF is kept for compatibility and can be wrong.

Key formulas

Terms introduced

Function
A named calculation built into a spreadsheet, such as SUM or IF, called in a formula with its arguments in parentheses.
Argument
A value, reference, range or expression given to a function inside its parentheses, such as the range in SUM(J2:J232).
Logical value
TRUE or FALSE: the result of a comparison such as J2>=50, and what IF, AND, OR and NOT work with.
Nested function
A function used as an argument of another function, as in ROUND(AVERAGE(M2:M232),2); the inner one is calculated first.
Text string
A piece of text in a cell or a formula, whose characters are numbered from 1; in a formula it is written in double quotation marks.
Concatenation
Joining pieces of text into one, with the & operator or a function such as CONCAT or TEXTJOIN.

Sources

  1. Microsoft Support. COUNT function (with the COUNTA and COUNTBLANK pages). support.microsoft.com/en-us/excel/count-function
  2. Microsoft Support. IF function – nested formulas and avoiding pitfalls. support.microsoft.com/en-US/Excel/if-function-nested-formula…
  3. Microsoft Support. IFS function. support.microsoft.com/en-us/excel/ifs-function
  4. Microsoft Support. IFERROR function. support.microsoft.com/en-us/office/iferror-function-c526fd07…
  5. Microsoft Support. FIND, FINDB functions. support.microsoft.com/en-gb/office/find-findb-functions-c791…
  6. Microsoft Support. DATE function. support.microsoft.com/en-us/excel/date-function
  7. Microsoft Support. DATEDIF function. support.microsoft.com/en-us/excel/datedif-function