Logical functions: IF, AND, OR and IFERROR
A comparison like B2>=50 gives TRUE or FALSE. IF turns that answer into a result you choose: =IF(. AND and OR let IF check two conditions, and IFERROR replaces an error with a message.
The topic then adds nested IF and IFS for more than two results, SWITCH for turning codes into names, and ISNUMBER, ISBLANK and ISERROR to check what a cell holds before you use it.
Lessons in this topic
- 1TRUE and FALSE comparisonsAbout 4 minutes
Compare cells with =, <, >, >=, <= and <> to get TRUE or FALSE. This is the yes-or-no question every IF formula asks.
- 2Choose a result with IFAbout 5 minutes
Use IF to show one result when a condition is TRUE and another when it is FALSE, in Excel and Google Sheets.
- 3Check two things with AND and ORPlusAbout 5 minutes
Use AND when every condition must be TRUE and OR when any one is enough, then put them inside IF.
- 4More than two results with nested IFPlusAbout 6 minutes
Put one IF inside another to sort values into three or more bands, like grades or delivery fees.
- 5Replace errors with IFERRORPlusAbout 4 minutes
Wrap a formula in IFERROR to show a clean value, like 0 or "New", instead of #DIV/0! when it can't be worked out.
- 6Grade bands with IFSPlusAbout 5 minutes
Use IFS to pick a grade or tier from several bands in one formula, without nesting IF inside IF, in Excel and Google Sheets.
- 7Turn codes into names with SWITCHPlusAbout 5 minutes
Use SWITCH to turn short codes into full names, with a default value for any code that isn't on your list.
- 8Check a cell with ISNUMBER, ISBLANK and ISERRORPlusAbout 6 minutes
Test whether a cell holds a number, text, nothing or an error with the IS functions, then use IF to show a clear message.