How to Format Excel Category Axis Gridlines by Time
Question details
The user wants to format the horizontal category axis in an Excel chart to display major gridlines at day boundaries and minor gridlines at hourly intervals.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Creating a detailed time-series chart where data needs to be visually separated by specific hour or minute intervals, but the default axis settings do not offer units smaller than a day.
- Observed behavior
- Standard category and date axes only provide 'Days', 'Months', or 'Years' as base units. Formatting the source data to a time format changes the label appearance but does not unlock hourly or minute axis units.
Verify your current chart type. Line charts and Column charts use category (or date) axes for the horizontal axis, which inherently lack support for time-based fractional intervals like hours or minutes.
Change the Chart Type to XY (Scatter) to Use a Value Axis
Converting your chart to an XY Scatter chart transforms the horizontal axis from a category axis into a value axis, allowing you to use decimals that correspond to specific hours or minutes.
Spreadsheet applications store dates and times as serial numbers, where 1 whole number equals 1 day (24 hours). Therefore, time can be expressed as a fraction of a day. For example, 1 hour is 1/24 (0.0416667) and 12 hours is 0.5.
By switching to a Scatter chart, you can input these precise decimal values into the axis Bounds and Units settings to force the gridlines to appear at hourly marks.
Right-click your existing chart and select 'Change Chart Type' from the context menu. Choose 'X Y (Scatter)' and pick a sub-type that connects data points with lines.
Right-click the horizontal (X) axis at the bottom of the chart and choose 'Format Axis'.
In the Format Axis pane under Axis Options, locate the 'Units' section and set the 'Major' unit to 1.0. This ensures major gridlines appear at the start of each new day.
Set the 'Minor' unit to 0.0416667 (which represents 1 divided by 24). This will generate minor gridlines exactly at one-hour intervals.

Use a Helper Series for Custom Gridlines
If you need to keep your original chart type (like a Column chart), you can add a secondary data series mapped to a secondary value axis to draw vertical lines that simulate minor gridlines.
Easily Customize Complex Charts in WPS Spreadsheet
WPS Spreadsheet offers powerful and intuitive charting features that let you seamlessly handle advanced data visualization tasks, including managing value axes and custom time intervals.
- 1. Open Your Data: Launch WPS Spreadsheet and open your existing workbook containing the time-series data.
- 2. Insert a Scatter Chart: Highlight your data, navigate to the 'Insert' tab, click 'Chart', and select an 'XY (Scatter)' line chart.
- 3. Access Axis Options: Double-click the horizontal axis to instantly open the formatting pane on the right.
- 4. Apply Decimal Units: Under 'Axis Options', input decimal representations of time (like 0.0416 for hourly) into the Major or Minor unit fields.

Frequently Asked Questions
Why does changing the source date format not affect my chart axis units?
Changing the number format of the source cells only alters how the data is visually labeled (e.g., displaying hours and minutes). It does not change the underlying axis type. A category or date axis is hardcoded to use days, months, or years as its smallest structural boundaries.
Can I format the X-axis labels to show both date and time?
Yes. Right-click the horizontal axis, select 'Format Axis', and scroll down to the 'Number' section. Choose 'Custom' from the category list and input a format code such as 'mm/dd/yyyy hh:mm AM/PM' to display detailed date and time stamps.
How do I calculate the axis unit for 15-minute gridlines?
Because 1 whole unit equals 24 hours (or 1440 minutes), you calculate a 15-minute interval by dividing 15 by 1440. This gives you 0.01041667. Enter this decimal value into your axis Major or Minor unit box while using a Scatter chart.




