🚀 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

⚠️ Salesforce Record IDs

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.

☁️ Salesforce

Case-Sensitive

Salesforce treats uppercase and lowercase characters as distinct when working with the 15-digit Record ID.

📊 Excel

Case-Insensitive

Excel can treat uppercase and lowercase characters as equivalent when comparing text values.

🔍 What Can Go Wrong?

Excel may see these values as the same

001ABC123XYZ789 15-digit Salesforce ID
=
001abc123xyz789 Different capitalization
⚠️
When you're using formulas such as VLOOKUP or XLOOKUP to match Salesforce records between Excel sheets, this can cause IDs that should be unique to appear as the same value.
🎯 The Solution

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.

🔐 Salesforce Record IDs

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.

Salesforce Formula
CASESAFEID(ID)
⚡ This formula converts the standard Record ID into an 18-digit Salesforce ID that you can include in reports or list views and export to Excel.

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.

From Salesforce Setup, navigate to Object Manager.
Setup → Object Manager
Choose the Salesforce object where the records you're working with are stored. For example, select Account, or choose another object such as Contact, Opportunity, Lead, or a custom object.
Create a new field and select Formula as the field type. This allows Salesforce to calculate the 18-digit ID automatically for each record.
Field Type → Formula
Give the field a simple, recognizable name. 18 ID is a practical option because it will be easy to identify later when building reports.
Example: 18 ID
Select Text as the formula's return type. The CASESAFEID formula produces the Salesforce Record ID as a string of characters, so Text is the appropriate return type.
Return Type → Text
Enter the following formula into the Formula Editor:

CASESAFEID(ID)

Click Next, review the field configuration, and then save the new formula field.
💡 You Can Skip the Page Layout
You don't necessarily need to add this formula field to any page layouts if your only goal is to use the 18-digit ID in reports or list views. You can skip that step and save yourself a few extra clicks.
🎯 What You End Up With

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.

📊 Salesforce Reports

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. 👇

Step 01

✏️ 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.

📊 Open Report
✏️ Edit
Step 02

🔍 Find the 18 ID Field

Search the available report fields for the formula field you created earlier.

🔎 Search
🆔 18 ID
Step 03

🔄 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.

🆕 New Field
🔄 Refresh
🆔 18 ID
Step 04

➕ 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.

🆔 18 ID
📊 Report Column
✅ Ready
🎉 You're ready to export! Your report now includes the 18-digit Salesforce Record ID. This gives you a reliable ID to work with when exporting Salesforce data to Excel for lookups, comparisons, and data manipulation.
Tip: Click through all four steps before exporting your report.

📊 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.

1
Add the 18-Digit ID
Include your newly created 18-Digit Salesforce ID formula field in the Salesforce report.
2
Export the Report
Export the Salesforce report and open the resulting file in Microsoft Excel.
3
Match Your Records
Use the 18-digit ID with VLOOKUP, XLOOKUP, or other Excel matching formulas.
🔄 Salesforce → Excel
Your Salesforce Record ID is now ready for spreadsheet work.
Salesforce Record
18-Digit Salesforce ID
Excel VLOOKUP / XLOOKUP
💡 Why this matters: Using the 18-digit Salesforce ID gives Excel a consistent identifier to work with when matching Salesforce records across spreadsheets.
🔎 Quick Check
What can you use the 18-Digit Salesforce ID for after exporting to Excel?

📋 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.

1
Open Your List View

Navigate to the Salesforce object and open the List View where you want the 18-digit ID to appear.

2
Edit the Columns

Use the List View controls to edit the columns displayed in the list.

3
Add the 18 ID Field

Find your custom 18 ID formula field and add it to the List View.

👀 List View Preview
Your 18-Digit Salesforce ID can now appear alongside your regular record information.
Account Name
18 ID
Farmers Co-op
001XXXXXXXXXXXXXXX
Example Company
001XXXXXXXXXXXXXXX
💡 Why use a List View? If you frequently need a quick view of your 18-Digit Salesforce ID, adding the field to a List View can be more convenient than creating a new report each time. It also gives you a simple way to access the ID alongside the records you're already working with.
✅ Remember This

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.

🔢
15-Digit ID

Standard Salesforce Record ID commonly displayed in Salesforce.

📊
Excel & Lookups

Excel can treat IDs differently when capitalization is involved.

🛡️
18-Digit ID

A better choice when exporting Salesforce records for spreadsheet work.

⚡ Formula to Remember
CASESAFEID(ID)
💡 Quick tip: Create the formula field once, add the 18-digit ID to your Salesforce reports or list views, and you'll have an Excel-friendly ID ready whenever you export your data.
🎥 Salesforce Tutorial

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.

💡 Tip: Watch the full tutorial first, then use the timestamps to quickly revisit the specific step you need when working with 18-digit Salesforce IDs.
⚡ Keep Learning

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.

Explore 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 standard Salesforce Record ID is 15 characters long and case-sensitive.

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.
15-Digit → Case-Sensitive 18-Digit → Case-Safe
Salesforce treats the 15-digit ID as case-sensitive, but Excel does not distinguish between uppercase and lowercase text when performing many comparisons.

This can create problems when using formulas such as VLOOKUP or XLOOKUP to match Salesforce records.
⚠️ Why it matters: Two Salesforce IDs that differ only by capitalization may be treated as the same value during an Excel lookup.
The 18-digit ID provides a case-safe representation of the Salesforce Record ID.

This makes it a safer choice when exporting Salesforce records to Excel and using the ID for matching, lookup, migration, or data manipulation.
Salesforce provides the CASESAFEID() function specifically for converting a 15-digit Record ID into its 18-digit case-safe version.
CASESAFEID(ID)
When creating the custom field:

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.
Not necessarily.

If you only need the 18-digit ID for reports or Salesforce List Views, you can skip adding the field to your page layouts.
💡 Save yourself a step: If users don't need to see the field directly on the record page, there's no need to add it to the layout.
Edit the Salesforce report and search for the new formula field you created.

Add the field as a report column.

If the field doesn't appear immediately, refresh the screen and check again.
Yes.

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.
Yes.

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:
CASESAFEID(ID)
Your exported spreadsheet will contain the 18-digit Salesforce ID alongside your other record data.

You can then use the ID when working with VLOOKUP, XLOOKUP, record matching, migration files, and other Excel workflows.
🎯 Best practice: When Salesforce data is going into Excel, using the 18-digit case-safe ID helps reduce problems caused by Excel's handling of capitalization.

Leave a Reply

Discover more from SMC Migrations

Subscribe now to keep reading and get access to the full archive.

Continue reading