✅ IF Function: How to Perform Conditional Logic in Google Sheets

🔍 What is the IF function?

The IF function lets you return different results depending on whether a condition is TRUE or FALSE.
It’s the foundation of most conditional logic in spreadsheets — just like an if statement in programming.

It’s widely used in dashboards, automation, error handling, and status-based formatting.


🧪 Syntax

=IF(condition, value_if_true, value_if_false)
  • condition: The logical test (e.g., A1>50, B1="Paid")
  • value_if_true: Returned if the condition is TRUE
  • value_if_false: Returned if the condition is FALSE

📌 Example 1: Pass or fail based on score

A (Score)B (Result)
185=IF(A1>=60, “Pass”, “Fail”)
240=IF(A2>=60, “Pass”, “Fail”)
367=IF(A3>=60, “Pass”, “Fail”)
490=IF(A4>=60, “Pass”, “Fail”)
555=IF(A5>=60, “Pass”, “Fail”)

👉 Output: Pass, Fail, Pass, Pass, Fail


📌 Example 2: Based on text value

A (Status)B (Next Step)
1Paid=IF(A1=”Paid”, “Prepare shipment”, “Pending”)
2Unpaid=IF(A2=”Paid”, “Prepare shipment”, “Pending”)
3Paid=IF(A3=”Paid”, “Prepare shipment”, “Pending”)

👉 Output: Prepare shipment, Pending, Prepare shipment


📌 Example 3: Nested IF statements for grading

=IF(A1>=90,"A",IF(A1>=80,"B",IF(A1>=70,"C","Retake")))
A (Score)B (Grade)
195A
282B
371C
466Retake

⚠️ When there are too many conditions, consider using IFS or SWITCH instead.


📌 Example 4: Checking if a cell contains a number

=IF(ISNUMBER(A1), "Number", "Not a number")
AB
1123Number
2TextValNot a number

💼 Real-World Use Case ①: Inventory order trigger

A (Stock)B (Status)
10=IF(A1=0, “Order Needed”, “In Stock”)
215In Stock
30Order Needed

Used in inventory management sheets to detect zero stock and alert buyers.


💼 Real-World Use Case ②: Sales target assessment

A (Sales)B (Rating)
11500000=IF(A1>=1000000, “Excellent”, “Average”)
2800000Average
32200000Excellent

⚠️ Common Mistakes

IssueExplanation
Missing quotesA1=Paid → ❌ should be A1="Paid"
Mixing up true/false orderThe formula must follow IF(condition, TRUE result, FALSE result)
Too many nested IFsUse IFS() or SWITCH() for cleaner logic

🧩 Best Companion Functions

FunctionUse
ISNUMBER, ISTEXTData type checks
IFERRORCatch and replace formula errors
FILTER, QUERYExtract conditional subsets
ARRAYFORMULAApply logic across entire columns
IFS, SWITCHCleaner multi-condition logic

✅ Summary

  • IF is a core tool for applying conditional logic in Google Sheets.
  • It’s flexible and works well with ranges, text, numbers, and formulas.
  • Combine it with ARRAYFORMULA, FILTER, and IFERROR to create powerful automated systems.

Similar Posts

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다