🔍 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 TRUEvalue_if_false: Returned if the condition is FALSE📌 Example 1: Pass or fail based on score A (Score) B (Result) 1 85 =IF(A1>=60, “Pass”, “Fail”) 2 40 =IF(A2>=60, “Pass”, “Fail”) 3 67 =IF(A3>=60, “Pass”, “Fail”) 4 90 =IF(A4>=60, “Pass”, “Fail”) 5 55 =IF(A5>=60, “Pass”, “Fail”)
👉 Output: Pass, Fail, Pass, Pass, Fail
📌 Example 2: Based on text value A (Status) B (Next Step) 1 Paid =IF(A1=”Paid”, “Prepare shipment”, “Pending”) 2 Unpaid =IF(A2=”Paid”, “Prepare shipment”, “Pending”) 3 Paid =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) 1 95 A 2 82 B 3 71 C 4 66 Retake
⚠️ 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")A B 1 123 Number 2 TextVal Not a number
💼 Real-World Use Case ①: Inventory order trigger A (Stock) B (Status) 1 0 =IF(A1=0, “Order Needed”, “In Stock”) 2 15 In Stock 3 0 Order Needed
Used in inventory management sheets to detect zero stock and alert buyers.
💼 Real-World Use Case ②: Sales target assessment A (Sales) B (Rating) 1 1500000 =IF(A1>=1000000, “Excellent”, “Average”) 2 800000 Average 3 2200000 Excellent
⚠️ Common Mistakes Issue Explanation Missing quotes A1=Paid → ❌ should be A1="Paid"Mixing up true/false order The formula must follow IF(condition, TRUE result, FALSE result) Too many nested IFs Use IFS() or SWITCH() for cleaner logic
🧩 Best Companion Functions Function Use 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.