Working with Salesforce records often involves exporting data to Excel for reporting or sharing. While Salesforce formula fields and reports display new lines or breaks perfectly on the platform, those line breaks can get lost during export—typically turning into HTML <br> tags or caret symbols that don’t translate into actual line breaks in Excel.
This blog post demonstrates a simple, reusable method to retain readable new lines directly in Excel exports using Salesforce formula fields and custom labels. This technique is especially useful for any object and scenario where you frequently export textual data and require preserved formatting for clarity or presentation.
A common approach is to create a formula in Salesforce that includes <br> tags for line breaks. While this works well in Salesforce record pages and reports, exporting the content to Excel results in those tags appearing as plain text (<br>) rather than visual line breaks. This forces users to post-process the exported file or use additional Excel formulas to properly reformat the content—an inconvenient and potentially error-prone extra step.
Instead of dealing with post-export cleanup in Excel, you can configure Salesforce to insert actual line breaks using a custom label in your formula field. Here’s how it works:
line_break). The value of this label should include a visible text value with a new line character between two letters (because Salesforce requires at least some value to be saved). For example, enter something like A\nB (A and B separated by an actual line break).A and B in this example) with null (empty strings) so that only the line break remains.By leveraging custom labels holding newline characters and strategic formula references, Salesforce admins and users can ensure clean, readable exported Excel files—no workarounds required post-export!
From my initial call with Spencer through project implementation with John and Evan, my experience with the SOLVD team was excellent. They were quick to understand our business needs, clear when explaining the reasoning behind proposed solutions, transparent when reporting on progress and timeline, and all around enjoyable to work with. Would highly recommend and looking forward to continue working with them in the future!
SOLVD was very straight forward with everything needed to complete the project. No surprises, no issues, and cost was aligned with the estimate. They made implementation easy and quick.
As a rule, I'm pretty stingy with my recommendations. So it's a pleasure for me to recommend Solvd as a top-flight Salesforce consultancy. Solvd recently led our company's conversion to the Lightning interface and did it on time, on budget and made it easy for me and my team. I know I'll use their services again, and am confident they can do the same for you.
Start Automating Today