0
0
Google Sheetsspreadsheet

Cross-column conditional rules in Google Sheets - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Concept Flow
    A       B       C       D
1 Product  Stock   Sales   Status
2 Apples   50      30      =IF(B2>C2, "Stock OK", "Restock Needed")
3 Bananas  20      25      
4 Cherries 15      10      
5 Dates    40      45      
We have a table with products, their stock, and sales. The formula in column D checks if stock is greater than sales to decide if stock is OK or restock is needed.
Formula
=IF(B2>C2, "Stock OK", "Restock Needed")

This formula compares the stock in B2 with sales in C2. If stock is more, it returns 'Stock OK'. Otherwise, it returns 'Restock Needed'.

Step-by-Step Trace
StepExpressionEvaluates ToExplanation
1B2 > C250 > 30Compare stock (50) with sales (30) for Apples.
2TRUETRUE50 is greater than 30, so condition is TRUE.
3IF(TRUE, "Stock OK", "Restock Needed")"Stock OK"Since condition is TRUE, formula returns 'Stock OK'.
The formula returns 'Stock OK' because stock is greater than sales for Apples.
Variable Tracker
CellValue
B250
C230
Key Moments
What does the condition B2 > C2 check?
What result does the formula return if the condition is TRUE?
What result does the formula return if the condition is FALSE?
Sheet Trace Quiz - 3 Questions
Test your understanding
What does the formula =IF(B2>C2, "Stock OK", "Restock Needed") check?
AIf stock is more than sales
BIf sales are more than stock
CIf stock equals sales
DIf stock is less than 10
Key Result
The IF formula compares two columns (Stock and Sales) row by row. It returns different text based on which value is greater, helping to quickly see if restocking is needed.
Transcript
We look at the formula =IF(B2>C2, "Stock OK", "Restock Needed") in cell D2. First, it compares the stock in B2 with sales in C2. Since 50 is greater than 30, the condition is TRUE. The formula then returns 'Stock OK'. This helps us know if the stock is enough compared to sales. If stock was less than sales, it would say 'Restock Needed'. This is a simple way to check two columns and show a message based on their values.