Use the FORMATNUMBER function to attach a preferred number format to the number itself instead of to its cell. The result is a formatted number value. For example, show 12.5 as 12.50 hours while formulas still see 12.5. For an overview, see Data types and dot functions in Excel.
Note
These features are rolling out to Microsoft 365 Insiders in Beta Channel on Windows Version 2612 (Build 20715.20000) or later and Mac Version 16.117 (Build 26111815) or later, and in Excel for the web.
Syntax
The FORMATNUMBER function returns a number with the format you specify. If you omit number_format, it removes the number's preferred format.
FORMATNUMBER(value, [number_format])
| Argument | Description |
|---|---|
| value (required) | The number to format, or a reference to a cell or range. Text, Booleans, and entities come back unchanged, so you can format a range that mixes numbers with other values. |
| number_format (optional) | A number format code, as text. Use the same codes as in Format Cells > Custom, for example "$#,##0.00" or "0.00"" hours""". If you omit it, FORMATNUMBER removes the value's preferred format. |
Notes
- The number doesn't change. =A2*1 returns 12.5 if A2 shows 12.50 hours.
- Arithmetic uses the number and drops the format: =A2+1 shows 13.5.
- Unlike TEXT, which returns text, FORMATNUMBER returns a number, so SUM and comparisons still treat it as one.
- Excel shows the preferred format only in cells formatted as General. If a number doesn't show your format, select its cell, and then select Home > Number Format > General.
- An empty format code ("") makes the value show nothing, but the number is still there. To remove the value's preferred format, omit number_format.
- To attach a format with dot syntax, use .SetNumberFormat(), which works the same way.
- You don't need FORMATNUMBER to keep an existing cell format: when ENTITY or .SetFields() references a formatted cell, the field keeps that cell's format.
Examples
Copy the example data and paste it in cell A1 of a new Excel worksheet. If you need to, you can adjust the column widths to see all the data.
Example 1
Show hours with a unit, keep the number, and then remove the format.
| Label | Value |
|---|---|
| Training hours | 12.5 |
| Format | 0.00" hours" |
| Formula | Result |
| =FORMATNUMBER(B2,B3) | 12.50 hours |
| =A5+1 | 13.5 |
| =ISNUMBER(A5) | TRUE |
| =FORMATNUMBER(A5) | 12.5 |
A5 is still the number 12.5, so arithmetic and ISNUMBER treat it as one. A8 omits the format, so it shows the plain number.
Example 2
Format currency and dates.
| Formula | Result |
|---|---|
| =FORMATNUMBER(1234.5,"$#,##0.00") | $1,234.50 |
| =FORMATNUMBER(DATE(2026,3,14),"d mmm yyyy") | 14 Mar 2026 |
Example 3
Keep a format inside an entity field.
| Formula | Result |
|---|---|
| =ENTITY("Order","Total",FORMATNUMBER(12.34,"$#,##0.00")) | Order |
| =A2.Total | $12.34 |
Example 4
Format a list that mixes numbers and text.
| Day | Hours |
|---|---|
| Monday | 12.5 |
| Tuesday | n/a |
| Wednesday | 8 |
| Formula | Result |
| =FORMATNUMBER(B2:B4,"0.00"" hours""") | 12.50 hours, n/a, 8.00 hours (spills into A6:A8) |
Errors
| Error | Cause |
|---|---|
| #VALUE! | number_format isn't a format code Excel can read. |