ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

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

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Productivity
  3. Custom Number Formats in Excel

Custom Number Formats in Excel

By ExcelReady Team·Updated October 30, 2026·5 min read

The short answer

A custom number format changes how a number looks without changing its value. Select the cells, press Ctrl+1 (Mac: ⌘1), choose Custom and type a code in the Type box, such as 00000 for leading zeros, #,##0,"K" for thousands or 0 "kg" for units. Formulas still use the real number underneath.

Key takeaways

  • Open Format Cells with Ctrl+1 (Mac: ⌘1), choose Custom, and type the code in the Type box.
  • 0 always shows a digit, # shows a digit only when needed, and a comma adds thousands separators.
  • Text in double quotes, like 0 "kg", adds a label but keeps the cell a real number.
  • A format can have four sections: positive; negative; zero; text.
  • Formatting changes only the display. Use the TEXT function when you need the formatted result as text.
On this page+
  1. What is a custom number format?
  2. How to create a custom number format
  3. The building blocks of format codes
  4. Useful custom formats you can copy
  5. The four sections: positive, negative, zero, text
  6. Custom date and time formats
  7. Custom formats vs the TEXT function
  8. Practise it

A custom number format in Excel lets you decide exactly how a number looks: leading zeros on IDs, sales shown as 1.2M, a "kg" label after weights, or negative numbers in red. The value in the cell doesn't change, so formulas keep working. This guide explains how the codes work and gives you formats you can copy.

What is a custom number format?#

A number format is a set of instructions for displaying a value. Excel's built-in formats (Currency, Percentage, Date) cover the basics, which our guide to formatting numbers as currency, percent and dates explains. A custom format is one you write yourself with a short code.

The key point: formatting changes the display, not the value. If a cell holds 0.256 and shows 26%, formulas use 0.256. You can always see the real value in the formula bar. The More formatting lesson shows this with dates and comma style.

How to create a custom number format#

  1. Select the cells.
  2. Press Ctrl+1 on Windows or ⌘1 on a Mac to open Format Cells. You can also right-click and choose Format Cells.
  3. On the Number tab, click Custom at the bottom of the Category list.
  4. Type your code in the Type box. The Sample area shows a preview.
  5. Click OK.

Your new code is saved in the list for that workbook, so you can reuse it. A quick start is to pick a built-in format first, then click Custom: the Type box shows that format's code, ready to edit.

The building blocks of format codes#

These characters do most of the work:

CodeWhat it doesValueFormatShows
0A digit that always shows, padding with zeros7.50.007.50
#A digit that shows only when needed7.5#.##7.5
, (between digits)Thousands separator1234567#,##01,234,567
, (at the end)Divides by 1,000 per comma1234567#,##0,1,235
.Decimal point0.50.00.5
%Multiplies by 100 and adds %0.2560.0%25.6%
"text"Shows the text as typed120 "kg"12 kg
@Stands for text typed in the cellNorth"Region: "@Region: North

A few characters, such as $, -, +, (, ) and a space, show without quotes. Everything else that you want to show as text should go in double quotes.

Useful custom formats you can copy#

You wantFormat codeValueShows as
Thousands with K#,##0,"K"12345671,235K
Millions with one decimal0.0,,"M"12345671.2M
Units after the number#,##0.0 "kg"1234.51,234.5 kg
Plus sign for positives+#,##0;-#,##0;01234+1,234
Negatives in red brackets#,##0;[Red](#,##0)-1234(1,234) in red
Five-digit ID with leading zeros000004200042

Leading zeros are a common need: an employee ID of 42 shown as 00042. The format keeps the cell a real number, so you can still sort and look it up as a number. If the ID must be stored with its zeros, for example to match a text code in another system, store it as text instead.

The four sections: positive, negative, zero, text#

A custom format can have up to four parts, separated by semicolons:

Excel formula
positive ; negative ; zero ; text

For example, #,##0;[Red]-#,##0;"-";@ shows positives normally, negatives in red with a minus sign, zeros as a dash, and text unchanged. If you write only one section, it applies to every number. With two, the first is for positives and zeros, and the second is for negatives.

Two handy tricks:

  • Hide zeros: 0;-0;;@ (the zero section is empty).
  • Hide everything: ;;; hides every value in the cell. The value still shows in the formula bar, so this is not a way to protect data. To stop people changing cells, see how to lock cells and protect a sheet.

Colour names go in square brackets at the start of a section: [Red], [Blue], [Green], [Black] and a few others. You can also add a condition, like [>=1000]#,##0,"K";0, to show values of 1,000 and above in thousands.

Custom date and time formats#

Dates in Excel are numbers (days since 1 January 1900), which is why the same date can look so different. Our article on why Excel stores dates as numbers explains the system.

CodeShowsExample for 3 Feb 2025
d / ddDay number3 / 03
ddd / ddddDay nameMon / Monday
m / mmMonth number2 / 02
mmm / mmmmMonth nameFeb / February
yy / yyyyYear25 / 2025

Combine them freely: ddd d mmm yyyy shows Mon 3 Feb 2025. For times, h:mm shows hours and minutes. To show total hours above 24, for example on a timesheet, use [h]:mm: a total of 27 hours 30 minutes shows as 27:30 instead of 3:30.

Custom formats vs the TEXT function#

A number format changes the display but keeps the number. The TEXT function uses the same codes but returns text, which you need when you join a number to words:

Excel formula
="Due "&TEXT(B2,"ddd d mmm")

This gives "Due Mon 3 Feb". Without TEXT you would get "Due 45691", the date's serial number. The TEXT and VALUE lesson has you build sentences like this, and our guide to the TEXT function and its format codes has more examples.

Use a number format when the cell will be calculated, sorted or charted. Use TEXT only when the result is a label. Before printing a formatted report, our guide to printing an Excel sheet neatly covers fit to page and titles.

Practise it#

Try the TEXT version of a date format in the exercise on this page. Then practise date and comma formats in a live spreadsheet, and use the TEXT and VALUE lesson to put format codes inside formulas.

Try it yourself

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

Format codes also work inside the TEXT function. B2 holds a shift date. In C2, show it as a short day and date, like Mon 3 Feb, with =TEXT(B2,"ddd d mmm").

fx
ABCD
1
Employee
Shift date
Label
2
Priya
2/3/2025
3
Marcus
2/4/2025
4
Lena
2/5/2025
5
6
7

Tip: ddd gives the short day name, d the day number and mmm the short month name. The code goes in double quotes.

Practise this in a lesson

LessonMore formattingItalic and underline, comma style, date format, and resetting a cell to General.LessonTEXT and VALUE: numbers to text and backFormat dates and dollar amounts inside sentences with TEXT, and turn digits stored as text into real numbers with VALUE.

Frequently asked questions

How do I create a custom number format in Excel?

+

Select the cells and press Ctrl+1 (⌘1 on a Mac). On the Number tab choose Custom, type your code in the Type box, check the Sample preview and click OK.

How do I keep leading zeros in Excel?

+

Apply a custom format with as many zeros as the code length, such as 00000 for five digits. The number 42 then shows as 00042, while the cell still holds 42.

How do I show numbers in thousands or millions?

+

End the code with a comma for each thousand you want to divide by: #,##0,"K" shows 1234567 as 1,235K, and 0.0,,"M" shows it as 1.2M. The value in the cell doesn't change.

Does a custom number format change the value?

+

No. It only changes what you see. Formulas, totals and lookups use the full value stored in the cell, which you can see in the formula bar.

How do I hide zeros or values with a number format?

+

Use 0;-0;; to hide zeros, because the empty third section is the zero format. Three semicolons (;;;) hide every value, though it still shows in the formula bar.

Sources

  • Create a custom number format - Microsoft Support
  • Review guidelines for customizing a number format - Microsoft Support
  • TEXT function - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 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 is a custom number format?
  2. How to create a custom number format
  3. The building blocks of format codes
  4. Useful custom formats you can copy
  5. The four sections: positive, negative, zero, text
  6. Custom date and time formats
  7. Custom formats vs the TEXT function
  8. Practise it

Keep reading

Productivity· 5 min read

Print an Excel Sheet Neatly: Fit to Page and Titles

To print an Excel sheet that fits the page, go to File > Print and change No Scaling to Fit All Columns on One Page, or set Width to 1 page in Page Layout > Scale to Fit. Switch to Landscape for wide tables, and use Page Layout > Print Titles with $1:$1 in Rows to repeat at top so headers print on every page.

Productivity· 4 min read

Protect a Sheet and Lock Cells in Excel

Every cell in Excel is locked by default, but locking only works once the sheet is protected. To lock formulas but let people type inputs, select the input cells, press Ctrl+1 (Mac: ⌘1), untick Locked on the Protection tab, then go to Review > Protect Sheet. Locked cells can then be viewed but not edited.

Basics· 5 min read

Format Numbers as Currency, Percent and Dates in Excel

To format numbers in Excel, select the cells and press a shortcut: Ctrl+Shift+$ for currency, Ctrl+Shift+% for percent and Ctrl+Shift+# for a date. On a Mac, use Control (⌃), not ⌘. Ctrl+1 (⌘1) opens Format Cells for more choices. Formatting changes only how a number looks; the value Excel stores stays the same.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free