🚀 How to Get the 18-Digit Salesforce ID for Excel?
If you’ve ever exported a Salesforce report into Excel and had your VLOOKUP or XLOOKUP formulas return the wrong results (or no results at all), the culprit might not be your formula — it might be your Salesforce ID. Getting the 18-digit Salesforce ID into your export instead of the default 15-digit version can save you a lot of head-scratching. Here’s exactly why it matters and how to set it up.
Table of Contents
The Problem With the 15-Digit Salesforce ID
By default, Salesforce reports display the standard
15-digit Record ID.
Inside Salesforce, this ID works perfectly fine because
it is case-sensitive — uppercase and lowercase
letters are treated as different characters.
The trouble starts when that ID lands in
Excel.
Case-Sensitive
Salesforce treats uppercase and lowercase characters as distinct when working with the 15-digit Record ID.
Case-Insensitive
Excel can treat uppercase and lowercase characters as equivalent when comparing text values.
Excel may see these values as the same
001ABC123XYZ789
15-digit Salesforce ID
001abc123xyz789
Different capitalization
Use the 18-Digit Salesforce ID
The 18-digit Salesforce ID is case-insensitive by design, which makes it a safer and more reliable option when working with Salesforce IDs in Excel and other external systems.
The Solution: Use CASESAFEID()
Salesforce has a built-in formula function made specifically for this situation: CASESAFEID(). It takes the standard Salesforce Record ID and converts it into its 18-digit equivalent.
CASESAFEID(ID)
How to Create an 18-Digit Salesforce ID Formula Field
Setting this up takes just a few minutes inside Salesforce Setup. Click each step below to see exactly what to do.
CASESAFEID(ID)
Click Next, review the field configuration, and then save the new formula field.
A reusable Salesforce formula field that automatically generates the 18-digit Record ID for each record — ready to add to reports, list views, and Excel exports.
How to Add the 18-Digit ID to a Salesforce Report
Your new formula field is ready. Now let's get it into your
Salesforce report so you can use the 18-digit ID
when working with exported data.
Click each step below to walk through the process. 👇
✏️ Edit Your Salesforce Report
Open the Salesforce report where you want to include your new 18 ID field, then click Edit to modify the report.
🔍 Find the 18 ID Field
Search the available report fields for the formula field you created earlier.
🔄 Give Salesforce a Moment
If the new field doesn't appear immediately, don't worry. Refresh the screen and search again. Newly created fields can sometimes take a moment to become available in the report builder.
➕ Add the 18-Digit ID
Select the 18 ID field and add it as a column in your report. Your Salesforce report can now display the case-safe Record ID.
📊 Export the 18-Digit Salesforce ID to Excel
With your 18-Digit Salesforce ID field added
to the report, you're ready to export your Salesforce records
to Excel.
Once exported, the spreadsheet will contain the
18-digit Salesforce ID alongside the rest
of your Salesforce data. From there, you can use the ID with
Excel functions such as VLOOKUP and
XLOOKUP for more reliable record matching.
📋 Add the 18-Digit Salesforce ID to a List View
The same custom formula field isn't limited to reports. You can also add your 18-Digit Salesforce ID directly to a Salesforce List View. This gives you another quick way to view and export the 18-digit ID without building a report every time.
Navigate to the Salesforce object and open the List View where you want the 18-digit ID to appear.
Use the List View controls to edit the columns displayed in the list.
Find your custom 18 ID formula field and add it to the List View.
Final Takeaway: Use the 18-Digit Salesforce ID
The 15-digit Salesforce ID works well inside Salesforce, but it can create problems when Salesforce data is exported to Excel.
If you're using VLOOKUP, XLOOKUP, or other spreadsheet formulas, the 18-digit Salesforce ID is the safer option for working with exported Salesforce records.
Standard Salesforce Record ID commonly displayed in Salesforce.
Excel can treat IDs differently when capitalization is involved.
A better choice when exporting Salesforce records for spreadsheet work.
CASESAFEID(ID)
Watch the 18-Digit Salesforce ID Tutorial
Want to see the entire process in action? Follow the video walkthrough to learn how to create an 18-digit Salesforce ID, use the CASESAFEID() formula, and add the field to a Salesforce report for export.
What's Covered in the Tutorial?
Click a timestamp to jump directly to that part of the video.
Take Your Salesforce Skills Further
Want to learn more about Salesforce data, migration, automation, and real-world workflows? Explore practical Salesforce training with Salesforce Masterclass.
❓ Frequently Asked Questions About the 18-Digit Salesforce ID
Find quick answers to common questions about Salesforce Record IDs, the 15-digit versus 18-digit format, CASESAFEID(), and using Salesforce IDs in Excel.
The 18-digit Salesforce ID is the case-safe version of that ID. It is designed to preserve the uniqueness of Salesforce Record IDs when they're used in systems that don't distinguish between uppercase and lowercase characters, such as Excel.
This can create problems when using formulas such as VLOOKUP or XLOOKUP to match Salesforce records.
This makes it a safer choice when exporting Salesforce records to Excel and using the ID for matching, lookup, migration, or data manipulation.
Field Type: Formula
Formula Return Type: Text
The formula returns the 18-digit Record ID as a string of characters, so Text is the appropriate return type.
If you only need the 18-digit ID for reports or Salesforce List Views, you can skip adding the field to your page layouts.
Add the field as a report column.
If the field doesn't appear immediately, refresh the screen and check again.
The same custom formula field can be added as a column in a Salesforce List View. This gives you another convenient way to view and export the 18-digit Salesforce ID without creating a separate report.
You can create the formula field on the Account object or another Salesforce object where you need access to the 18-digit Record ID.
The formula remains:
You can then use the ID when working with VLOOKUP, XLOOKUP, record matching, migration files, and other Excel workflows.