Table of Contents
Use IF to decide what a row should display, SWITCH to translate a known code, and SUMIFS or COUNTIFS to summarize rows that meet several conditions. The examples use commas between arguments. In some regional settings, Excel uses semicolons instead.
1. IF and IFS for thresholds
If C2 contains a score, this formula includes exactly 3.5 in the satisfactory group.
=IF(C2>=3.5,"Satisfactory","Needs review")For several bands, IFS returns the result for the first true condition. Put the highest threshold first. The final TRUE handles values below the lowest threshold, and the first check leaves a blank score unclassified.
=IFS(C2="","",C2>=4.5,"Excellent",C2>=3.5,"Good",C2>=2.5,"Average",TRUE,"Needs review")
2. SWITCH for exact value matches
Use SWITCH to translate the department code in B2 into a full name. The final argument is the fallback for an unrecognized code.
=SWITCH(B2,"HR","Human Resources","IT","Information Technology","FIN","Finance","Unknown")
3. CHOOSE for a numbered list
If E2 contains a quarter number from 1 to 4, CHOOSE returns the label at that position. Restrict the input to whole numbers in that range if people enter it manually.
=CHOOSE(E2,"Q1","Q2","Q3","Q4")
4. AND and OR for multiple conditions
AND requires every test to pass. Here the status must be Active and the score must be at least 4. OR returns true when any test passes, as in the separate check for records marked Pending or On hold.
=IF(AND(D2="Active",C2>=4),"Meets both conditions","Review")
=IF(OR(D2="Pending",D2="On hold"),"Follow up","")
5. SUMIFS, COUNTIFS, and AVERAGEIFS for matching rows
Suppose column B contains department codes, C contains scores, and E contains amounts. These formulas sum the amounts, count the rows, and average the scores for the same group of IT records with scores of at least 4. Keep all ranges aligned to the same rows.
=SUMIFS(E2:E100,B2:B100,"IT",C2:C100,">=4")
=COUNTIFS(B2:B100,"IT",C2:C100,">=4")
=AVERAGEIFS(C2:C100,B2:B100,"IT",C2:C100,">=4")If the cutoff is stored in H2, write the criterion as ">="&H2. For a single condition, see common SUMIF errors and check the argument order before reusing a formula.
6. IFERROR and IFNA for expected errors
IFERROR catches any Excel error. Use it when the same fallback makes sense for every error, as in a display-only ratio. If you only expect a zero denominator, check for that specifically so other problems stay visible.
=IFERROR(C2/E2,"Unavailable")IFNA only replaces #N/A. Here a lookup takes an ID from H2 and searches the first column of A2:D100. Unexpected errors, such as a broken reference, still show.
=IFNA(VLOOKUP(H2,A2:D100,4,FALSE),"ID not found")
For additional examples in worksheets, see common Excel formulas for accounting.
Reader Comments 0
Sign in with email or Google to join the discussion.