Hello everyone, I'm Uncle Xia, a 10-year-old driver in the workplace. I'm currently an engineer in a Fortune 500 company. I use Excel all the year round at work.

Previous Article A Complete Guide to Drop-Down Lists

What I want to share with you today is how to display negative numbers as red in Excel. Uncle Xia summed up the following four methods for you.


Method 1: Use Number Format

The most direct way is to use the number format or currency format, the steps are as follows:

  1. selected range of cells

  2. Right-click and select "Format Cells"

  3. Select "Number" - "Currency" in turn, then select the last negative form, and click "OK"


picture


Method 2: Use a custom format

We can also set it by customizing the format, such as displaying positive numbers in green and negative numbers in red. Proceed as follows:

  1. selected range of cells

  2. Right-click and select "Format Cells"

  3. Select "Number" - "Custom"

  4. Enter this code in the "Type" input box: [green]$#,##0.00;[red]-$#,##0.00;$0.00

  5. Finally click "OK"


picture

Let's analyze what this code means.

picture

This code consists of multiple parts:
① Positive, negative and zero values ​​are separated by semicolons
② The positive number is in the first position, we can specify a color in the square brackets in front of the number format string, such as green
③ The negative number is in the second position, you can also specify a color
④ The zero value is in the third position, and a color can also be specified
Method 3: Use Conditional Formatting
Conditional formatting can format cells based on custom rules, and can modify any type of cell formatting, such as borders, font sizes, font styles, and fill colors. You can also change the font color to red when the value of the cell is less than 0.
The operation steps are as follows:
  1. First select the cell range, then click Start - Conditional Formatting - New Rule
  2. Select "Format only cells that contain"
  3. Select the cell value in turn - less than, enter 0 in the input box on the right
  4. Then click [Format] - [Font], select red, and click OK.

picture


Method 4: Use VBA code
We can also automate the processing by writing VBA code. Press the shortcut key Alt + F11 to open the VBA code editor, click "Insert" - "Module" at the top, and you can add VBA code and save it in a new window.

picture

Sub ChangeFontColor()Dim rng As Range
For Each rng In Selection If rng.Value < 0 Then rng.Font.Color = vbRed Else rng.Font.Color = vbBlack End IfNext rngEnd Sub
This code will loop in the selected area of ​​the worksheet to check whether the value of the cell is less than 0, if it is less than 0, set the color to red; otherwise, set the color to black.
Specific steps are as follows:
  1. Select the area with numbers
  2. Press the shortcut key Alt + F8 to pop up the "Macro" dialog box
  3. Select ChangeFontColor and click "Execute" directly

picture

Well, I'll share it here with you today. If you like Uncle Xia's article, remember to like and watch Uncle Xia, thank you~~
[Recommendation of previous articles]
  1. 230 most complete Excel shortcut keys, this article is enough!

  2. A must-have for finance people: 10 tips for working with dates and times!

  3. Master these 36 skills and you will become an Excel master

  4. How to make the first option of a drop-down list in Excel blank

  5. Remove spaces in cells, do you really?

  6. EXCEL's multi-window operation, it's really fun!

  7. How to quickly split text in cells

  8. 6 Ways to Convert Text to Numbers

  9. Have you mastered all the knowledge points about EXCEL drop-down lists?