ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Logic
  3. What the Double Negative (--) Does in Excel Formulas

What the Double Negative (--) Does in Excel Formulas

By ExcelReady Team·Updated November 2, 2026·6 min read

The short answer

The double negative (--) in Excel turns TRUE into 1 and FALSE into 0. The first minus makes TRUE into -1, and the second makes it 1 again. You need it in formulas like =SUMPRODUCT(--(B2:B7="East")), because SUMPRODUCT treats TRUE and FALSE as zero. It also turns numbers stored as text, like "0042", into real numbers.

Key takeaways

  • -- is two minus signs: the first turns TRUE into -1, the second turns -1 into 1. FALSE stays 0.
  • SUMPRODUCT ignores TRUE and FALSE, so =SUMPRODUCT(--(B2:B7="East")) is how you count with it.
  • Always put the test in brackets: --(B2:B7="East"), not --B2:B7="East".
  • Multiplying two tests together, (test1)*(test2), already gives 1s and 0s, so no -- is needed there.
  • For simple counts and sums, COUNTIFS and SUMIFS are easier and need no --.
On this page+
  1. What does the double negative (--) do?
  2. Why SUMPRODUCT needs the double negative
  3. How to sum with a condition using --
  4. When you don't need the double negative
  5. Using -- with ISNUMBER and SEARCH
  6. Using -- to turn text into numbers
  7. Common mistakes with the double negative
  8. Practise it

The double negative in Excel, written --, turns TRUE into 1 and FALSE into 0. You'll see it in formulas like =SUMPRODUCT(--(B2:B7="East")), where it makes a list of yes-or-no answers into numbers that can be counted and added. This guide explains what each minus sign does, when you need -- and when you don't, with examples you can type in.

What does the double negative (--) do?#

The double negative is two minus signs in a row. A single minus in front of a value makes it negative. Excel treats TRUE as 1 when it does math, so one minus turns TRUE into -1, and a second minus turns it back to 1:

Value-value--value
TRUE-11
FALSE00
"0042" (text)-4242
"abc" (text)#VALUE!#VALUE!

So -- doesn't change a number; it changes the type. TRUE and FALSE become 1 and 0, and text that looks like a number becomes a real number. The fancy name for it is "double unary", because a minus in front of a single value is called a unary operator.

Why SUMPRODUCT needs the double negative#

A comparison like B2:B7="East" returns one TRUE or FALSE for each row. You can see this in the TRUE, FALSE and comparisons lesson. The problem is that SUMPRODUCT treats TRUE and FALSE as zero, so it can't count them. All the examples below use this sales table in A1:D7:

ABCD
1RepRegionProductSales
2AnaEastLaptop Pro820
3BenWestMonitor450
4ChenEastLaptop Air610
5DaraNorthLaptop Pro990
6EliEastDock230
7FayWestLaptop Air540

Compare these two formulas:

Excel formula
=SUMPRODUCT((B2:B7="East"))
=SUMPRODUCT(--(B2:B7="East"))

The first returns 0, even though three rows are East. The second returns 3, because -- turns the six answers into {1;0;1;0;1;0} before SUMPRODUCT adds them. The SUMPRODUCT function guide and the full SUMPRODUCT article cover the function itself.

How to sum with a condition using --#

Give SUMPRODUCT the 1s and 0s as one array and the numbers as another. It multiplies them row by row and adds the results:

Excel formula
=SUMPRODUCT(--(B2:B7="East"),D2:D7)

Row by row that is 1×820 + 0×450 + 1×610 + 0×990 + 1×230 + 0×540, which gives 1660. Each 0 removes a row that failed the test, and each 1 keeps it.

When you don't need the double negative#

You only need -- when TRUE and FALSE would otherwise reach SUMPRODUCT on their own. Any math operation converts them too, so multiplying two tests together already gives 1s and 0s:

Excel formula
=SUMPRODUCT((B2:B7="East")*(D2:D7>500))

This counts East rows with sales over 500 and returns 2 (Ana and Chen). Adding -- in front of each test would also work but isn't needed. The same goes for *1 or +0: all three ways convert TRUE to 1. Pick one and use it consistently.

For plain counts and sums with simple conditions, COUNTIFS and SUMIFS are easier to read and need no conversion at all:

Excel formula
=SUMIFS(D2:D7,B2:B7,"East")

This returns the same 1660. The COUNTIFS and SUMIFS lesson teaches them, and SUMPRODUCT vs SUMIFS and COUNTIFS vs SUMPRODUCT explain when the longer SUMPRODUCT version is worth it, such as testing part of a cell or doing math on a column before comparing.

Using -- with ISNUMBER and SEARCH#

The double negative shows up a lot with ISNUMBER and SEARCH, to count cells that contain a word anywhere in the text:

Excel formula
=SUMPRODUCT(--ISNUMBER(SEARCH("laptop",C2:C7)))

SEARCH finds "laptop" in each product name and returns a position number, or #VALUE! when it isn't there. ISNUMBER turns those into TRUE or FALSE, and -- turns them into 1 or 0. The result is 4: Laptop Pro twice and Laptop Air twice. No brackets are needed around ISNUMBER, because a function result is already one value. The guide to ISNUMBER with SEARCH covers this pattern in depth.

Using -- to turn text into numbers#

The double negative also converts numbers stored as text. If A2 holds the text "0042":

Excel formula
=--A2

returns the number 42. It's handy inside other formulas, such as =--LEFT(A2,4) to turn the first four digits of a code into a number you can compare with > or <. VALUE does the same thing and is easier to read: =VALUE(A2). If the text isn't a number at all, both return #VALUE!.

Common mistakes with the double negative#

Most -- problems come from brackets and from the order Excel works in:

  1. Missing brackets around the test. Excel applies the minus signs before comparisons. So --B2:B7="East" tries to make the text in B2:B7 negative first and returns #VALUE!. Always write --(B2:B7="East"). The comparison operators guide lists the order Excel uses.
  2. Putting -- outside the whole formula. =--SUMPRODUCT((B2:B7="East")) still returns 0, because SUMPRODUCT has already ignored the TRUE values. The -- must touch the TRUE/FALSE array.
  3. Using SUM in older Excel. =SUM(--(B2:B7="East")) works in Excel 2021 and Microsoft 365. In Excel 2019 and earlier, it needs Ctrl+Shift+Enter, so use SUMPRODUCT instead.
  4. Ranges of different sizes. Every array in SUMPRODUCT must have the same number of rows, or it returns #VALUE!.

Practise it#

The double negative makes sense once you've seen comparisons return TRUE and FALSE yourself. Practise TRUE, FALSE and comparisons in a live spreadsheet, then practise COUNTIFS and SUMIFS so you know when -- isn't needed at all. Both check your formula as you type. Start with the exercise on this page: total the East sales in one formula.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

What are total sales for the East region? In G2, use SUMPRODUCT with a double negative on the Region test: =SUMPRODUCT(--(B2:B7="East"),D2:D7), then press Enter.

fx
ABCDEFGH
1
Rep
Region
Product
Sales
2
Ana
East
Laptop Pro
820
East sales
3
Ben
West
Monitor
450
4
Chen
East
Laptop Air
610
5
Dara
North
Laptop Pro
990
6
Eli
East
Dock
230
7
Fay
West
Laptop Air
540
8
9
10

Tip: Put the test B2:B7="East" in brackets, -- in front of it, then a comma and the Sales column.

Practise this in a lesson

LessonTRUE, FALSE and comparisonsAsk Excel yes-or-no questions with =, <>, >, <, >= and <=, and get TRUE or FALSE back. The building block of every IF.LessonCOUNTIFS and SUMIFSCount and sum with several conditions at once, and learn why SUMIFS puts the sum range first.Function guideSUMPRODUCTMultiply columns and add the results in one step with SUMPRODUCT. Totals, weighted averages, conditions, and a live exercise to try.

Frequently asked questions

What does -- mean in an Excel formula?

+

It is two minus signs, called a double negative or double unary. It turns TRUE into 1 and FALSE into 0, and turns text that looks like a number into a real number, without changing the value's sign.

Why use -- in SUMPRODUCT?

+

SUMPRODUCT treats TRUE and FALSE as zero, so a test like (B2:B7="East") on its own adds up to 0. Putting -- in front turns the results into 1s and 0s that SUMPRODUCT can add.

Is -- the same as multiplying by 1?

+

Yes, for this purpose. --(B2:B7="East"), (B2:B7="East")*1 and (B2:B7="East")+0 all give the same 1s and 0s. Many people prefer -- because it is short and clearly a conversion.

Do I need -- with COUNTIFS or SUMIFS?

+

No. COUNTIFS and SUMIFS take conditions as text, like "East" or ">500", and never produce TRUE or FALSE arrays, so there is nothing to convert.

Why does my double negative formula return #VALUE!?

+

Either the test is missing its brackets, so the minus signs hit the text before the comparison runs, or -- was used on text that isn't a number, like "abc". Put the test in brackets and check the data.

Sources

  • SUMPRODUCT function - Microsoft Support
  • Calculation operators and precedence in Excel - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What does the double negative (--) do?
  2. Why SUMPRODUCT needs the double negative
  3. How to sum with a condition using --
  4. When you don't need the double negative
  5. Using -- with ISNUMBER and SEARCH
  6. Using -- to turn text into numbers
  7. Common mistakes with the double negative
  8. Practise it

Keep reading

Math· 6 min read

SUMPRODUCT in Excel: Multiply and Add in One Step

SUMPRODUCT multiplies matching items in two or more ranges and adds up the results. =SUMPRODUCT(C2:C7,D2:D7) multiplies each quantity by its price and returns the total, with no helper column. It also handles conditions, such as =SUMPRODUCT((B2:B7="North")*C2:C7*D2:D7), and works in every version of Excel.

Comparisons· 8 min read

COUNTIFS vs SUMPRODUCT for Counting With Conditions

Use COUNTIFS for most conditional counts: it is fast, easy to read and handles several AND conditions and wildcards. Use SUMPRODUCT when COUNTIFS can't express the test, such as OR logic in one formula, comparing two columns row by row, or applying a function like MONTH or LEFT to a column before checking it.

Logic· 6 min read

Excel Comparison Operators: =, <>, >, <, >=, <=

In Excel, "not equal to" is written <>, so =A2<>"Delivered" returns TRUE when A2 is anything other than Delivered. Excel has six comparison operators: = equal, <> not equal, > greater than, < less than, >= greater than or equal, and <= less than or equal. Each returns TRUE or FALSE.

More on logic

  • Letter Grade Formula in Excel: IFS or a Lookup Table
  • IF with AND in Excel: Check Two Conditions at Once
  • Use AND and OR Together in One IF Formula
  • IF Between Two Numbers in Excel
  • IF Cell Is Blank in Excel: Formulas That Work
  • IF Formulas With Dates in Excel: Before, After, Overdue
All logic articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free