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 just a random piece of text. I’ve seen teams spend hours manually retyping dates or trying to use the “Text to Columns” wizard, which is honestly a waste of time. But there’s a much faster way to handle this.
The quick fix for SOQL to Excel dates
Look, the solution is actually pretty simple once you know which parts of that string to ignore. We just need to strip out the “T” in the middle and the timezone offset at the end. Then, we tell Excel to treat the remaining text as a number. This is probably the most overlooked trick when cleaning up raw data exports.
The Magic Formula
Assuming your raw SOQL date is in cell A2, drop this formula into B2:
=VALUE(SUBSTITUTE(LEFT(A2, 19), "T", " "))So what’s happening here? First, LEFT(A2, 19) grabs the first 19 characters. This gives you the date and the time but cuts off the milliseconds and the +0000 suffix. Then, SUBSTITUTE swaps that annoying “T” for a space. Finally, VALUE turns that 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. So why does this matter? 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, you can just add or subtract the offset directly in the formula. For example, 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 just 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. If you want to speed up your workflow even more, I’d suggest checking out some 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 allows Excel to parse the date-time structure.
- Always format the cell as a Date or Custom time string after applying the formula.
- Mastering SOQL to Excel dates allows for better filtering and duration calculations in your offline reports.
Getting your SOQL to Excel dates right 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. Give it a try on your next export and see how much cleaner your data looks.








Leave a Reply