Function Problems

Use Excel IF to Detect Negative Numbers or Text Starting with a Minus Sign

Muhammad TalhaMuhammad Talha Nov 22, 2026 868 views

Question details

Identify negative numeric values or text beginning with a minus sign and return -1 for a match or 0 otherwise.

Use Excel IF to Detect Negative Numbers or Text Starting with a Minus Sign
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet column may contain a mixture of numbers and text that need different checks.
Observed behavior
The desired formula returns -1 for a negative number or text starting with a minus sign, and 0 for other values.
Before you start

Identify the first cell to check and choose an empty cell for the result. The examples below check A2 and can be adjusted to match your worksheet.

Solution 1Recommended

Check Both Numbers and Text with IF and ISNUMBER

Use this formula when the cells may contain either numeric values or text.

1
Enter the formula

Select an empty cell, such as B2, and enter =IF(ISNUMBER(A2),IF(A2<0,-1,0),IF(LEFT(A2,1)="-",-1,0)).

2
Apply it to other rows

Press Enter, then drag the fill handle from B2 down the column to check the remaining cells.

Check Both Numbers and Text with IF and ISNUMBER
How the checks differ: Numeric values are tested against zero; text is checked for a minus sign as its first character. Cell formatting alone does not change the underlying value.
Try it in WPS Office

Detect Negative Numbers and Minus-Sign Text in WPS Spreadsheets

Use IF, ISNUMBER, and LEFT in WPS Spreadsheets to check mixed numeric and text values and return a consistent result.

  1. 1. Open your spreadsheet: Open WPS Spreadsheets and select Open to load your workbook.
  2. 2. Enter the formula: Select B2 and enter =IF(ISNUMBER(A2),IF(A2<0,-1,0),IF(LEFT(A2,1)="-",-1,0)).
  3. 3. Fill the formula down: Press Enter, then drag the fill handle from B2 down to check the other rows.
  4. 4. Save the workbook: Select Menu > Save As and choose an Excel workbook format if you need to share the file with Excel users.
Check negative numbers and leading minus signs in one formulaOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and fill handlesWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't =IF(A2="-*",-1,0) match text starting with a minus sign?

In a direct IF comparison, the asterisk is treated as a literal character, not a wildcard. Use =IF(LEFT(A2,1)="-",-1,0) to check the first character.

Can COUNTIF detect text that starts with a minus sign?

Yes. Use =-COUNTIF(A2,"-*") to return -1 when text in A2 starts with a minus sign and 0 otherwise. The asterisk is a wildcard in the COUNTIF criterion.

What does the tilde mean in the COUNTIF criterion "-~*"?

The tilde escapes the asterisk, so "-~*" matches the literal text -* rather than any text beginning with a minus sign. Use "-*" for the wildcard match.

Will the combined formula detect a negative number formatted without a minus sign?

Yes. ISNUMBER identifies the numeric value, and the formula checks whether it is less than zero, regardless of how the cell displays it.