Convert TRUE or FALSE to 1 or 0 in Excel

Convert TRUE or FALSE to 1 or 0 in Excel

Last Updated on 08/06/2023
Reading time: 2 minutes

How to convert the result of a test, TRUE or FALSE, by the value 1 and 0

Basic logical test in Excel

In Excel, any logical test returns TRUE or FALSE.

For instance, to compare the contents of 2 columns, you have to write the following test.

=A2=B2

Test to compare the value of 2 columns

In this second example, we want to know if our customer has 21 years old or more. So we create the following test with an absolute reference to the limit cell.

=B2>=$G$4

Age Greater than 21

How to convert the test to a numeric value?

So when you create a test in Excel, the result is TRUE or FALSE by default.

Tips 💡The result of a logical test is always displayed in the center of the cell, ALWAYS 😉

But, you can convert TRUE or FALSE to 1 or 0 with 2 different method

Method 1: Multiply by 1

The first method is to multiply the logical test by 1

=(logical test)*1

Convert logical test by multiply by 1

You can see in column D the formula used

Method 2: Write 2 dashes

The other technique is to write 2 dashes before the test like in this example.

=--(logical test)

Convert logical test with 2 dashes

And the result is the same; the test returns 0 or 1.

Leave a Reply

Your email address will not be published. Required fields are marked *

Convert TRUE or FALSE to 1 or 0 in Excel

Reading time: 2 minutes
Last Updated on 08/06/2023

How to convert the result of a test, TRUE or FALSE, by the value 1 and 0

Basic logical test in Excel

In Excel, any logical test returns TRUE or FALSE.

For instance, to compare the contents of 2 columns, you have to write the following test.

=A2=B2

Test to compare the value of 2 columns

In this second example, we want to know if our customer has 21 years old or more. So we create the following test with an absolute reference to the limit cell.

=B2>=$G$4

Age Greater than 21

How to convert the test to a numeric value?

So when you create a test in Excel, the result is TRUE or FALSE by default.

Tips 💡The result of a logical test is always displayed in the center of the cell, ALWAYS 😉

But, you can convert TRUE or FALSE to 1 or 0 with 2 different method

Method 1: Multiply by 1

The first method is to multiply the logical test by 1

=(logical test)*1

Convert logical test by multiply by 1

You can see in column D the formula used

Method 2: Write 2 dashes

The other technique is to write 2 dashes before the test like in this example.

=--(logical test)

Convert logical test with 2 dashes

And the result is the same; the test returns 0 or 1.

Leave a Reply

Your email address will not be published. Required fields are marked *