MAKE DECISIONS XOR Function in Excel and Googl… Return TRUE when an odd number of the supplied… Excel 2013+ Google Sheets Same syntax Microsoft Excel D2 =XOR(logical1, [logical2], ...) A B C D Request Dept Approved Finance Approv… Exclusive 2 REQ-001 TRUE FALSE TRUE 3 REQ-002 TRUE TRUE FALSE 4 REQ-003 FALSE FALSE FALSE
Learning Hub Functions Make Decisions

XOR Function in Excel and Google Sheets

Make Decisions 📊 Excel 2013+ ✓ Google Sheets Same syntax in both apps
Purpose
Return TRUE when an odd number of the supplied conditions are TRUE, FALSE when zero or an even number are TRUE
Return value
TRUE when an odd count of arguments evaluate to TRUE, FALSE when zero or an even count are TRUE
XOR is the logical function for exclusive choices — situations where exactly one of two conditions should be true, and having both true is just as wrong as having neither. Most spreadsheet work is handled by AND and OR, but occasionally a data-validation or workflow rule requires exclusive logic. An entry should be in either the primary system OR the backup system, but not both simultaneously and not missing from both. A purchase request should be approved by either department management OR the finance team, but dual-approval indicates an exception that needs review. XOR surfaces these cases automatically. With two arguments it is simple: TRUE when exactly one is TRUE, FALSE when both are TRUE or when neither is. Once you understand this, XOR becomes a surprisingly practical tool for audit flags in data where mutual exclusivity matters.
Syntax
✓ Excel 2013+ ✓ Google Sheets = Same syntax
=XOR(logical1, [logical2], ...)
Arguments
ArgumentRequiredDescription
logical1 Required The first condition to evaluate. Any expression that returns TRUE or FALSE — comparisons, logical functions, or cell references containing booleans. Numbers work too: zero is FALSE and any non-zero number is TRUE.
logical2 ... Optional Additional conditions, up to 255 total. XOR returns TRUE when an odd count of all arguments are TRUE — not when zero or an even count are TRUE.
How it works
XOR evaluates all its arguments and counts how many are TRUE. If the count is odd — one, three, five — XOR returns TRUE. If the count is zero or even — zero, two, four — XOR returns FALSE. With two arguments this reduces to: TRUE when exactly one is TRUE, FALSE when both are TRUE or when neither is. This is the exclusive OR of classical logic. In practice, almost all spreadsheet XOR formulas use exactly two arguments because the odd-count behaviour for three or more arguments is rarely what business rules require. XOR is most useful inside IF when you want to flag rows where the exclusive condition is met: =IF(XOR(B2,C2),"Exclusive","Check") flags rows where exactly one of two boolean columns is TRUE. Numbers are treated as booleans: zero is FALSE and any other number is TRUE. Text values cause a #VALUE! error.
Examples
1
Flag approval requests where exactly one of two sign-offs has been given — department OR finance, but not both and not neither.
fx =XOR(B2,C2)
A B C D
1 Request Dept Approved Finance Approved Exclusive
2 REQ-001 TRUE FALSE =XOR(B2,C2)
3 REQ-002 TRUE TRUE FALSE
4 REQ-003 FALSE FALSE FALSE
5 REQ-004 FALSE TRUE TRUE
6 REQ-005 TRUE FALSE TRUE
Row 2: TRUE — REQ-001 has department approval but not finance approval — exactly one is TRUE so XOR returns TRUE.
REQ-002 has both approvals so XOR returns FALSE — the even count (two TRUE) fails the exclusive condition. REQ-003 has neither so XOR returns FALSE — zero TRUE also fails. XOR is TRUE only when exactly one approval is present.
2
Check that a product appears in exactly one store — Store A exclusive or Store B, flagging duplicates and missing listings.
fx =XOR(B2,C2)
A B C D
1 Product Store A Store B Exclusive
2 PRD-001 TRUE FALSE =XOR(B2,C2)
3 PRD-002 FALSE TRUE TRUE
4 PRD-003 TRUE TRUE FALSE
5 PRD-004 FALSE FALSE FALSE
6 PRD-005 TRUE FALSE TRUE
Row 2: TRUE — PRD-001 is in Store A but not Store B — exactly one condition is TRUE so XOR returns TRUE.
PRD-003 is in both stores so XOR returns FALSE — a distribution error. PRD-004 is in neither so XOR also returns FALSE — a missing listing. Both cases need attention.
3
Inside an IF, label each request as Valid when exactly one payment method is selected, and Check when both or neither are selected.
fx =IF(XOR(B2="Card",C2="Transfer"),"Valid","Check")
A B C D
1 Order Payment A Payment B Status
2 ORD-001 Card None =IF(XOR(B2="Card",C2="Transfer"),"Valid","Check")
3 ORD-002 None Transfer Valid
4 ORD-003 Card Transfer Check
5 ORD-004 None None Check
6 ORD-005 Card None Valid
Row 2: Valid — ORD-001 has Card in column B (TRUE) and None in column C (FALSE) — exactly one condition is TRUE so XOR returns TRUE and IF outputs Valid.
ORD-003 has both payment columns filled — XOR returns FALSE so Check is shown, flagging it for review. ORD-004 has neither so it also returns Check.
Common use cases
1. Validate that an approval request has exactly one sign-off rather than dual approval or none
=IF(XOR(B2,C2),"Valid","Review")
2. Confirm a product appears in exactly one distribution channel — not both and not missing
=XOR(B2="Active",C2="Active")
3. Check that a form entry has content in exactly one of two mutually exclusive fields
=XOR(B2<>"",C2<>"")
4. Flag data migration records that exist in exactly one of two systems during a transition period
=IF(XOR(C2="System A",D2="System B"),"Migrated","Check")
5. Detect alternating TRUE-FALSE patterns in a sequence for validation of toggle-style data
=XOR(A2,A3)
Common errors
#VALUE! error
One of the arguments contains text that is not the word TRUE or FALSE and cannot be interpreted as a boolean. XOR only works with boolean values and numbers.
Fix: Ensure each argument is a comparison like B2=TRUE, a cell containing a boolean, or a number. Text values like "yes" or "approved" are not booleans and cause #VALUE! unless compared: B2="yes".
XOR returns FALSE when you expected TRUE
Both conditions are TRUE (even count) or both are FALSE (zero count). XOR requires an odd number of TRUE values.
Fix: Check whether the result should use OR (any TRUE is enough) instead of XOR (odd count of TRUE). If both conditions being TRUE should also return TRUE, OR is the right function.
Confusing XOR with OR for multiple arguments
With three or more arguments, XOR returning TRUE for an odd count of TRUE values — not just exactly one — can produce unexpected results.
Fix: Limit XOR to two arguments for straightforward exclusive-choice validation. For three or more choices, use a different approach such as COUNTIF on the boolean column equalling 1.
Tips and variations
Wrap XOR in IF to produce readable labels instead of raw TRUE and FALSE
XOR returns the boolean TRUE or FALSE directly. Wrapping it in IF converts the result to a meaningful label like Valid or Review that is far more useful in a report or dashboard.
=IF(XOR(B2,C2),"Valid","Check")
Use XOR for mutual-exclusivity audits on boolean columns
Any time you have two boolean columns where exactly one should be TRUE, XOR is the one-formula audit check. It surfaces both the both-true error and the neither-true error in a single column without any IF nesting.
=XOR(B2,C2)
Limit XOR to two arguments for predictable behaviour
The odd-count behaviour of XOR with three or more arguments is mathematically correct but unintuitive in business contexts. Stick to two arguments for clear exclusive-choice logic. For broader multi-condition checks, AND and OR are more predictable.
=XOR(B2="Primary",C2="Primary")
Excel vs Google Sheets
Excel vs Google Sheets
XOR is available in Excel 2013 and newer and in all versions of Google Sheets. It is not available in Excel 2010 or earlier. The syntax and odd-count TRUE behaviour are identical in both applications. Formulas copy between Excel 2013+ and Google Sheets without changes.
Related reading
Frequently asked questions
XOR performs exclusive OR logic. It returns TRUE when an odd number of its arguments are TRUE, and FALSE when zero or an even number are TRUE. With two arguments, this means TRUE only when exactly one of the two is TRUE — not both and not neither. It is used to detect mutually exclusive conditions.
OR returns TRUE when one or more arguments are TRUE — including when all of them are TRUE. XOR returns TRUE only when an odd count of arguments is TRUE. With two arguments, OR is TRUE when at least one is TRUE (including both), while XOR is TRUE only when exactly one is TRUE. Use XOR when having both conditions true at the same time is as invalid as having neither.
XOR is useful for exclusive-choice validation — situations where a value must belong to exactly one of two categories. For example, a record should be in either System A or System B but not both and not neither. A request must be approved by either the department or finance but not by both simultaneously, which would indicate a workflow error.
Yes. XOR accepts up to 255 arguments. With more than two, XOR returns TRUE when an odd number of them are TRUE — one, three, five, and so on. This is the mathematical exclusive OR generalised to multiple inputs. In practice, most XOR use cases in spreadsheets involve exactly two arguments.
Yes. XOR works identically in Excel 2013 and newer and in Google Sheets. The syntax, behaviour, and treatment of numbers as booleans are the same in both applications. Note that XOR is not available in Excel 2010 or earlier.