0% found this document useful (0 votes)
69 views11 pages

Excel XOR Function

The document explains the Excel XOR function, which returns TRUE if an odd number of conditions are TRUE, and FALSE if an even number are TRUE. It provides examples of using XOR to check if a Pokemon is either Fire type OR has HP less than 60, but not both. It also shows how to use XOR within an IF function to return "Yes" if one condition is TRUE, and "No" if both are FALSE or TRUE together.

Uploaded by

Emre Karademir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views11 pages

Excel XOR Function

The document explains the Excel XOR function, which returns TRUE if an odd number of conditions are TRUE, and FALSE if an even number are TRUE. It provides examples of using XOR to check if a Pokemon is either Fire type OR has HP less than 60, but not both. It also shows how to use XOR within an IF function to return "Yes" if one condition is TRUE, and "No" if both are FALSE or TRUE together.

Uploaded by

Emre Karademir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

8/24/23, 5:11 PM Excel XOR Function

Dark code
 Menu  Bootcamps Spaces Sign Up Log in

L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS


  C  C+

Excel XOR Function


❮ Previous Next ❯

XOR Function
The XOR function is a premade function in Excel, which returns TRUE or FALSE
based on two or more conditions.

Note: The XOR function is often used together with the IF function.

It is typed =XOR :

=XOR([logical1], [logical2], ...)

The conditions are referred to as [logical1] , [logical2] , and so on.

The conditions can check things like:

If a number is greater than another number >


If a number is smaller than another number <
If a number or text is equal to something =

For two conditions, you can think of the XOR function as: "either this or that, but
not both"

Dark mode
https://www.w3schools.com/excel/excel_xor.php k d 1/11
8/24/23, 5:11 PM Excel XOR Function
Dark ,code
Note: The different parts of the function are separated by a symbol, like comma
 Menu 
or semicolon ;
Bootcamps Spaces Sign Up Log in

L The
CSSsymbol
JAVASCRIPT
depends on SQL PYTHON Settings.
your Language JAVA PHP HOW TO W3.CSS
  C  C+

Example XOR Function


Check if the Pokemon type is either Fire type OR has HP less than 60, but not both:

The function returns "TRUE" or "FALSE".

Copy Values

Example XOR function, step by step:

1. Select the cell D2


2. Type =XOR
3. Double click the XOR command

Dark mode
https://www.w3schools.com/excel/excel_xor.php k d 2/11
8/24/23, 5:11 PM Excel XOR Function
Dark code
 Menu  Bootcamps Spaces Sign Up Log in

L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS


  C  C+

4. Specify the first condition B2="Fire"


5. Type ,
6. Specify the second condition C2<60
7. Hit enter

Note: You can add more conditions by repeating steps 5-6 before hitting enter.

The XOR function returns "TRUE" if an odd number (1,3,5,..) of conditions are TRUE.

Since the value in cell B2 is not "Fire" the first condition is FALSE.

Since the value in cell C2 is less than 60 the second condition is also FALSE.

For two conditions, only one condition should to be TRUE for the XOR function to
return TRUE.
Dark mode
https://www.w3schools.com/excel/excel_xor.php k d 3/11
8/24/23, 5:11 PM Excel XOR Function
Dark code
 Menu  Bootcamps
Note: Text values needs to be in quotes: " "
Spaces Sign Up Log in

L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS


  C  C+

The function can be repeated with the filling function for each row to perform the
same check for each Pokemon:

Now, each row has a check for Fire Type or HP less than 60, but not both:

For example:

Ivysaur is not Fire type, but it also does not have less than 60 defense, so the
function returns "FALSE".
Charmeleon is Fire type, and has less than 60 defense, so the function returns
"FALSE" Dark mode
https://www.w3schools.com/excel/excel_xor.php k d 4/11
8/24/23, 5:11 PM Excel XOR Function

Wartortle is not Fire type, but has less than 60 defense, so the functionDark code
returns
 Menu 
"TRUE" Bootcamps Spaces Sign Up Log in

L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS


  C  C+

Example XOR Function (with IF)


Combining the XOR function with an IF function lets you check multiple conditions
for the IF function:

Note: The IF function lets you specify the return values.

The IF function is typed =IF and has 3 parts:

=IF(logical_test, [value_if_true], [value_if_false])

The XOR function takes the place of the logical_test condition.

Here, the IF function returns "Yes" or "No".

Example XOR function as the condition for IF function, step by step:

1. Select cell C2
2. Type =IF
3. Double click the IF command

4. Type XOR
5. Double click the XOR command
Dark mode
https://www.w3schools.com/excel/excel_xor.php k d 5/11
8/24/23, 5:11 PM Excel XOR Function
Dark code
 Menu  Bootcamps Spaces Sign Up Log in

L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS


  C  C+

7. Specify the first condition B2="Fire"


8. Type ,
9. Specify the second condition C2<60
10. Type ),
11. Specify the value "Yes" for when just one condition is TRUE
12. Type ,
13. Specify the value "No" for when both are FALSE, or TRUE at the same time
14. Type ) and hit enter

The function can be repeated with the filling function for each row to perform the
same check for each Pokemon:

Dark mode
https://www.w3schools.com/excel/excel_xor.php k d 6/11
8/24/23, 5:11 PM Excel XOR Function
Dark code
 Menu  Bootcamps Spaces Sign Up Log in

L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS


  C  C+

Now, each row has a check for Water Type or Defense greater than 60, but not
both:

For example:

Ivysaur is not Fire type, but it also does not have less than 60 defense, so the
function returns "No".
Charmeleon is Fire type, and has less than 60 defense, so the function returns
"No"
Wartortle is not Fire type, but has less than 60 defense, so the function returns
"Yes"

❮ Previous Next ❯

Dark mode
https://www.w3schools.com/excel/excel_xor.php k d 7/11
8/24/23, 5:11 PM Excel XOR Function
Dark code
 Menu  Bootcamps Spaces Sign Up Log in

L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS


  C  C+

COLOR PICKER



Dark mode
https://www.w3schools.com/excel/excel_xor.php k d 8/11
8/24/23, 5:11 PM Excel XOR Function
Dark code
 Menu  Bootcamps Spaces Sign Up Log in

L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS


  C  C+

Spaces

Upgrade

Newsletter

Get Certified

Report Error

Top Tutorials Dark mode


https://www.w3schools.com/excel/excel_xor.php k d 9/11
8/24/23, 5:11 PM Excel XOR Function

HTML Tutorial Dark code


 Menu  Bootcamps
CSS Tutorial
JavaScript Tutorial
Spaces Sign Up Log in

How To Tutorial
L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS
  C  C+
SQL Tutorial
Python Tutorial
W3.CSS Tutorial
Bootstrap Tutorial
PHP Tutorial
Java Tutorial
C++ Tutorial
jQuery Tutorial

Top References
HTML Reference
CSS Reference
JavaScript Reference
SQL Reference
Python Reference
W3.CSS Reference
Bootstrap Reference
PHP Reference
HTML Colors
Java Reference
Angular Reference
jQuery Reference

Top Examples
HTML Examples
CSS Examples
JavaScript Examples
How To Examples
SQL Examples
Python Examples
W3.CSS Examples
Bootstrap Examples
PHP Examples
Java Examples
XML Examples
jQuery Examples

Get Certified
HTML Certificate
CSS Certificate
JavaScript Certificate
Front End Certificate
SQL Certificate
Python Certificate
PHP Certificate
jQuery Certificate
Java Certificate
C++ Certificate
C# Certificate
XML Certificate

Dark mode
https://www.w3schools.com/excel/excel_xor.php k d 10/11
8/24/23, 5:11 PM Excel XOR Function
Dark
FORUM code
| ABOUT

 Menu  Bootcamps Spaces Sign Up Log in


W3Schools is optimized for learning and training. Examples might be simplified to improve reading and
learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot
L  CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS
 C  C+
our
warrant full correctness of all content. While using W3Schools, you agree to have read and accepted
terms of use, cookie and privacy policy.

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.


W3Schools is Powered by W3.CSS.

https://www.w3schools.com/excel/excel_xor.php 11/11

You might also like