How to Convert ISO Timestamps to Dates and Hours for Excel Pivot Tables
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.

- 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.
Create two new blank helper columns next to your timestamp data to store the extracted Date and Hour values before applying any formulas.
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.
Insert two new columns next to your timestamp data. Name the first column 'Date' and the second 'Hour'.
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.
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.
Click on the first cell in your new Hour column and enter the formula: =HOUR(VALUE(TEXTBEFORE(SUBSTITUTE(A3,"T"," "),"."))). Press Enter.
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.

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. Open your dataset: Launch WPS Spreadsheet and open the file containing your ISO timestamps.
- 2. Apply extraction formulas: Use the INT and HOUR formulas combined with text extraction to create your helper columns.
- 3. Insert a Pivot Table: Select your updated dataset, navigate to the 'Insert' tab, and click 'PivotTable'.
- 4. Group your data: Drag your newly created 'Date' and 'Hour' fields into the Rows or Columns area to analyze your metrics effectively.

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.




