Excel 图表把日期显示成数字(轴上的序列号)
2024 年 1 月 8 日的序列号是 45299。轴或源单元格若被设为数字或常规格式,就会看到这个数字而不是日期。在 Excel 中右键横轴,打开“设置坐标轴格式”,将数字格式设为日期。Google Sheets 在图表编辑器的自定义 > 横轴中设置,或先把源列设为日期。
本文目录
快速解答
2024 年 1 月 8 日的序列号是 45299。轴或源单元格若被设为数字或常规格式,就会看到这个数字而不是日期。在 Excel 中右键横轴,打开“设置坐标轴格式”,将数字格式设为日期。Google Sheets 在图表编辑器的自定义 > 横轴中设置,或先把源列设为日期。
=DATE(2024,1,8)
=TEXT(DATE(2024,1,8),"yyyy-mm-dd")检查要点
2026 年 11 月 12 日测试中,=DATE(2024,1,8) 为 45299,TEXT 得到 2024-01-08。把同一字符串存为文本后,ISTEXT 为 TRUE,ISNUMBER 为 FALSE,DATEVALUE 仍为 45299。只改轴格式无法把文本变成日期轴,需先转换源列。
边界与兼容性
若轴显示 1、2、3,或日期被当成第二条很大的数值系列,多半是分类轴没用日期列。在“选择数据”中把日期设为横轴标签,把收入或数量设为系列。透视表图表同样可能继承常规格式;若无法按月组合,先修好源日期。
完整英文示例、公式与作者备注
Excel How-toTested in: The serial,
TEXT, andDATEVALUEresults below were evaluated in Google Sheets on 12 November 2026. Excel 365 menu names are the current desktop labels; I did not click through Format Axis in Excel this session.
How to pick a line vs a column chart is in How to Make a Chart in Excel. This page is only about an axis that shows serials.
The number is the date
Excel and Google Sheets store a date as a whole number of days from a fixed origin. In the test workbook:
=DATE(2024,1,8)
=TEXT(DATE(2024,1,8),"yyyy-mm-dd")
The first formula is serial 45299 (that is what you see if the cell or the axis is formatted as a number). The second returned 2024-01-08. Nothing is “wrong” with 45299 except the format.
In Excel 365
- Click the chart, then right-click the horizontal axis.
- Choose Format Axis.
- Open the Number section (sometimes under Axis Options).
- Set the category to Date, or type a format code such as
yyyy-mm-ddord-mmm. - If the axis still shows 1, 2, 3, the chart is not using your date column as the category. Open Select Data and set the horizontal (category) labels to the date range.
In Google Sheets
- Click the chart, then open the chart editor.
- Under Customize > Horizontal axis, set a date number format if the option is there.
- If it is not, format the source date column as a date (Format > Number > Date) and, in Setup, confirm the date column is the X-axis.
When the source is text, not a serial
Formatting the axis does not fix labels that were typed as text. A cell can look like 2024-01-08 and still be text. In the test workbook I stored those characters as text in L4:
=ISTEXT(L4)
=ISNUMBER(L4)
=DATEVALUE(L4)
On 12 November 2026 those returned TRUE, FALSE, and 45299. DATEVALUE produced the same serial as =DATE(2024,1,8). Put that converted column on the axis, or paste the values over the text, then format the axis as a date.
If DATEVALUE returns #VALUE!, the text is not in a date order your locale expects. Use the conversions in dates stored as text. Mixed columns — some real dates, some text — produce an axis that looks partly numbered, partly labeled, and a line chart that treats the labels as unordered categories.
The axis used the wrong column
A second common cause is a chart built from the value column only. Excel then uses 1, 2, 3 as the axis, or it plots the dates as a second series of large numbers (45299 sits far above a revenue series of 7800). In Select Data, the date column should be the category axis, and the revenue (or quantity) column should be the series. Do not include both the date serial and the revenue as two series on the same value axis.
A pivot chart can show serials for the same reason: the date field is a number, and the chart inherited a General format. Format the axis, or group the pivot dates first so the axis shows month labels. If Group is disabled, fix the source as in cannot group dates in a pivot table.
Once the axis shows 8 Jan 2024 instead of 45299, check that the points are in date order. Text labels sort alphabetically; real dates sort as numbers, which is what you want on a time scale.