Excel Tutorial
Excel tutorials, quizzes & AI guides — all levels
RSS
  • Online Excel Exercises
  • Training
  • Excel Tests
  • Sitemap
  • Premium Quizzes
  • Shop
  • My account

Convert TRUE/FALSE to 1/0 in Excel

Conditional
Reading time: 2 minutes
Views: 37,340

Do you know you can convert the result of a logical test, TRUE or FALSE, to 1 or 0? It’s straightforward and highly useful for utilizing functions like SUM. Two techniques can be used

  1. Multiply the outcome of a logical test by 1
  2. Apply the hyphen method to transform the result (my favorite)👍

Result of a logical test in Excel

In Excel, a logical test returns TRUE or FALSE. For instance, to determine if a customer is 21 years-old or older, we can write the following test with an absolute reference to the limit cell.

Logical test age greater than 21

Training articles

  • Training Logical Test – Beginner Level
  • Training Logical Test – Intermediate Level
  • Excel Test for IF, IFS & IFERROR functions

How to convert the test to a numeric value?

Method 1: Multiply by 1

The first method is to multiply the logical test by 1. The logical test should be placed in parentheses to ensure the result is always accurate.

=(logical test)*1

Convert logical test multiply by 1

Method 2: Add 2 hyphens before the logical test

The other technique is to write 2 hyphens before the test, as in this example, with the same result

=–(logical test)

Use Hyphen to convert true and false

Using this technique with a SUM function

Now, because we can convert true and false to 0 and 1, we can include logical test in a function like SUM. But this time, we must perform the test on the range of cells, and not only one cell like we did previously.

=SUM(–(B2:B9>=F4))

Logical test inside a SUM function

Of course, you can have a similar result with the COUNTIF function =COUNTIF(B2:B9,">="&F4)

Related articles

  • Build a Logical Test in Excel
  • Convert a Text Date to a Number Date

Frédéric LE GUEN

logical test

Leave a Reply Cancel reply

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

Most Viewed Posts

  • Displaying Negative Numbers in Parentheses in Excel (310,065)
  • Top 10 Excel Functions You Must Know (232,001)
  • How to make automatic calendar in Excel (212,775)
  • Dash for a zero in Excel automatically (190,813)
  • Converting a Date from YYYYMMDD to DD/MM/YYYY in Excel (171,034)
image excel exercises
Excel Exercises
image excel quizzes
Excel Quizzes

Convert TRUE/FALSE to 1/0 in Excel

Reading time: 2 minutes
Views: 37,340

Do you know you can convert the result of a logical test, TRUE or FALSE, to 1 or 0? It’s straightforward and highly useful for utilizing functions like SUM. Two techniques can be used

  1. Multiply the outcome of a logical test by 1
  2. Apply the hyphen method to transform the result (my favorite)👍

Result of a logical test in Excel

In Excel, a logical test returns TRUE or FALSE. For instance, to determine if a customer is 21 years-old or older, we can write the following test with an absolute reference to the limit cell.

Logical test age greater than 21

Training articles

  • Training Logical Test – Beginner Level
  • Training Logical Test – Intermediate Level
  • Excel Test for IF, IFS & IFERROR functions

How to convert the test to a numeric value?

Method 1: Multiply by 1

The first method is to multiply the logical test by 1. The logical test should be placed in parentheses to ensure the result is always accurate.

=(logical test)*1

Convert logical test multiply by 1

Method 2: Add 2 hyphens before the logical test

The other technique is to write 2 hyphens before the test, as in this example, with the same result

=–(logical test)

Use Hyphen to convert true and false

Using this technique with a SUM function

Now, because we can convert true and false to 0 and 1, we can include logical test in a function like SUM. But this time, we must perform the test on the range of cells, and not only one cell like we did previously.

=SUM(–(B2:B9>=F4))

Logical test inside a SUM function

Of course, you can have a similar result with the COUNTIF function =COUNTIF(B2:B9,">="&F4)

Related articles

  • Build a Logical Test in Excel
  • Convert a Text Date to a Number Date
Tags: logical test

Frédéric LE GUEN

Leave a Reply Cancel reply

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

Contact us
About me 
Privacy Policy

© 2022 – 2026 – excel-tutorial.com. All Rights Reserved.
Excel Tutorial is managed by majordome du net

Contact us
About me 
Privacy Policy

© 2022 – 2026 – excel-tutorial.com. All Rights Reserved.
Excel Tutorial is managed by majordome du net