Pivot Table Issues

How to Convert ISO Timestamps to Dates and Hours for Excel Pivot Tables

Kushani NimanthikaKushani Nimanthika Nov 11, 2026 868 views

Question details

The user needs to extract date and hour values from ISO-format timestamps to prepare data for hourly grouping in a pivot table.

Convert Timestamps to Dates and Hours for Excel Pivot Tables
Product
Excel
Device & OS
not provided
Scenario
Preparing timestamped data (e.g., 2024-05-08T09:05:58.800-07:00) for pivot table analysis by splitting it into manageable components.
Observed behavior
The raw data is in a single string format that pivot tables cannot natively group by hour, requiring a split into separate date and hour helper columns.
Before you start

Create two new blank helper columns next to your timestamp data to store the extracted Date and Hour values before applying any formulas.

Solution 1Recommended

Extract Date and Hour using Excel Formulas

Use a combination of text and time functions to cleanly separate the date and hour from complex ISO timestamps into helper columns.

ISO-style timestamps contain a 'T' separating the date and time, and often end with fractional seconds or timezone data. By substituting the 'T' with a space and parsing the text before the decimal point, Excel can recognize the string as a standard date and time value.

1
Create Helper Columns

Insert two new columns next to your timestamp data. Name the first column 'Date' and the second 'Hour'.

2
Enter Date Formula

Assuming your first timestamp is in cell A3, click on the first cell in your new Date column and enter the formula: =INT(VALUE(TEXTBEFORE(SUBSTITUTE(A3,"T"," "),"."))). Press Enter.

3
Format Date Column

Select the cell with the formula result, press Ctrl+1 to open the Format Cells dialog, and choose a 'Short Date' format to display it correctly.

4
Enter Hour Formula

Click on the first cell in your new Hour column and enter the formula: =HOUR(VALUE(TEXTBEFORE(SUBSTITUTE(A3,"T"," "),"."))). Press Enter.

5
Apply to the Entire Dataset

Select both formula cells, and double-click the fill handle (the small square at the bottom-right corner of the selection) to drag the formulas down for all your data rows.

Extract Date and Hour using Excel Formulas
Ready for Pivot Tables: You can now use these new Date and Hour helper columns in your Pivot Table fields to accurately group your data by specific hours and days.
Efficient Data Analysis

Easily Analyze Timestamps with WPS Spreadsheet

WPS Spreadsheet offers full compatibility with advanced Excel formulas like TEXTBEFORE and SUBSTITUTE, allowing you to manipulate complex data and create insightful Pivot Tables instantly.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the file containing your ISO timestamps.
  2. 2. Apply extraction formulas: Use the INT and HOUR formulas combined with text extraction to create your helper columns.
  3. 3. Insert a Pivot Table: Select your updated dataset, navigate to the 'Insert' tab, and click 'PivotTable'.
  4. 4. Group your data: Drag your newly created 'Date' and 'Hour' fields into the Rows or Columns area to analyze your metrics effectively.
Fully compatible with Microsoft Excel formulas and functions.Seamless handling of complex text and timestamp data.Intuitive Pivot Table interface for quick hourly and daily groupings.Lightweight, fast, and completely free to use.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my extracted date look like a random 5-digit number?

Spreadsheet software stores dates as serial numbers. To view the date correctly, select the cell, right-click, choose 'Format Cells', and select the 'Date' category.

Can a Pivot Table group timestamps automatically without helper columns?

While Pivot Tables have a built-in 'Group' feature for standard dates, complex ISO text strings with timezones usually require helper columns first so the software can recognize them as proper date and time values.

What if I need the exact minute and second as well?

You can use the =MINUTE(...) and =SECOND(...) functions surrounding the same core extraction formula VALUE(TEXTBEFORE(SUBSTITUTE(A3,"T"," "), ".")) to pull minutes and seconds into their own separate columns.

Why does the formula return a #NAME? error?

The #NAME? error occurs if you are using an older version of Excel that does not support the newer TEXTBEFORE function. In this case, you may need to use a combination of LEFT, FIND, or MID functions instead to parse the text.