KeepSorted

Google Sheets IF formula: if this cell, then that, else something else (text, number, blank, AND, OR)

Say which cell to test, what to test for, and what to show when it is true or not. Copy the formula. You can test one cell, add a second test with AND or OR, or fill a whole column in one formula. It runs in your browser and nothing you type here is sent anywhere. Every formula below was run in a real Google Sheet on 3 November 2026 (upper and lower case, blank cells, zero, numbers stored as text, quotes, a divide by zero) once in a US-locale spreadsheet and once in a German-locale one with semicolons.


Your formula

How to use it

Paste the formula into one cell. For a whole column, paste it in the first row of the result column and leave the cells below it empty, or Sheets shows a #REF! error. Text in the formula goes in double quotes; the builder adds them. A number or a cell like D1 is left without quotes.

Which one to pick

You pickThe formula uses
One testIF(B2 > 100, "High", "Low")
Contains textIF(ISNUMBER(SEARCH("ab", A2)), "yes", "no")
Two tests, bothIF(AND(A2 = "paid", B2 > 5), "y", "n")
Two tests, eitherIF(OR(A2 = "paid", B2 > 5), "y", "n")
A whole columnARRAYFORMULA(IF(B2:B = "", "", IF(B2:B > 10, "big", "small")))
Two tests, whole columnARRAYFORMULA(IF((A2:A <> "a") * (B2:B > 100), "y", "n"))

The catches (found by testing in a real Sheet)

No code: KeepSorted

The add-on sorts the original table in place without code: no second copy, so formatting, checkboxes and notes move with their rows and people keep editing the same table. Select the range, pick the sort columns, Save. Free: one area per tab, up to 2 sort columns, no trial clock. Pro ($5/month or $39/year): up to 5 sort columns, custom orders like High > Medium > Low, ticked checkbox rows to the bottom, stacked tables sorted separately, and sorting after form responses, other editors' changes and an hourly check.

KeepSorted is built and in testing. It is not in the Google Workspace Marketplace yet. Leave your email and we send one message when you can install it.

You're on the list. We'll email you when KeepSorted is ready.

The generators and the formulas stay free either way.

More KeepSorted tools and guides

Sources