Skip to main content
New tool CRON Expression Builder — preview next run times before you schedule Apex. Open the builder →
A screenshot showing a formula converting Salesforce ISO date strings to readable Excel dates for SOQL data.
Admin

Convert SOQL to Excel dates - Fix Salesforce ISO strings

Export Salesforce data, then find Excel can't read the dates. Here is a quick formula to clean up those ISO strings so you can get back to your analysis.

Ever run a query in the Salesforce Inspector or Workbench and realized the output is a mess? One of the biggest headaches for consultants is converting SOQL to Excel dates, because Salesforce exports them in that long ISO format like 2024-08-14T14:48:05.000+0000.

Excel sees that string and just gives up. It won't let you sort by time or run a pivot table because it thinks the date is a random piece of text. I've seen teams spend hours manually retyping dates or fighting with the "Text to Columns" wizard, which is honestly a waste of time. There's a much faster way to handle this.

The quick fix for SOQL to Excel dates

The solution is pretty simple once you know which parts of that string to ignore. Strip out the "T" in the middle and the timezone offset at the end, then tell Excel to treat the remaining text as a number.

The magic formula

Assuming your raw SOQL date is in cell A2, drop this formula into B2:

=VALUE(SUBSTITUTE(LEFT(A2, 19), "T", " "))

LEFT(A2, 19) grabs the first 19 characters, which gives you the date and the time but cuts off the milliseconds and the +0000 suffix. SUBSTITUTE swaps that annoying "T" for a space. VALUE turns the remaining string into a serial number Excel understands.

Handling timezones with SOQL to Excel dates

One thing that trips people up is that Salesforce exports everything in UTC. If you're based in New York or London, your Excel report might look like it's a few hours off. That matters more than it sounds: if you're reporting on SLAs or business hours, being five hours off can ruin your entire analysis.

If you need to adjust for your local timezone, add or subtract the offset directly in the formula. If you're 5 hours behind UTC, you'd subtract 5/24 from the result. It's much faster than trying to fix it later. When I'm managing Salesforce large data volumes for a client, I always do this conversion in a staging sheet before presenting the final numbers.

One thing to watch out for: if your export has different precision (like missing milliseconds), the 19-character count might need a quick tweak. Always double-check your first few rows.

Formatting the result

When you first hit enter, Excel might show you a weird decimal number like 45518.61. Don't panic. That's just how Excel stores time internally. You need to change the cell format so it looks like a human date again.

  • Highlight your column and hit Ctrl+1.
  • Go to Custom.
  • Type in yyyy-mm-dd hh:mm:ss.

Now you've got a clean, sortable column. It makes a huge difference when you're trying to calculate the time between a Lead being created and the first activity. To speed up your workflow further, look at Salesforce Chrome extensions like the Inspector, which makes getting these exports easier in the first place.

Key takeaways

  • The ISO format from SOQL isn't natively recognized by Excel as a date.
  • Trimming the string to 19 characters removes the unnecessary timezone suffix.
  • Replacing the "T" with a space lets Excel parse the date-time structure.
  • Always format the cell as a Date or Custom time string after applying the formula.
  • Getting SOQL to Excel dates right gives you better filtering and duration calculations in your offline reports.

This is one of those small skills that makes you look like a pro to your stakeholders. It saves you from those "why does this report look wrong?" emails on a Friday afternoon.

Newsletter

One email every Tuesday

New guides, tool updates, and the release-note changes that break things.

No spam. Unsubscribe in one click.

Comments

Loading comments...

Leave a Comment