Matching Leads to Accounts in Salesforce

If you’re using Leads and Contacts in Salesforce it can be a bit hard to track all people at the Account level – there’s no native matching of Leads to Accounts in Salesforce. Implementing Lead to Account matching in Salesforce is pretty easy, though – here are the steps:

First, create a ‘domain’ formula field on Account that ‘cleans’ any value in the website field to just return a ‘clean domain’ – the formula looks like this:

SUBSTITUTE(
  IF(
      FIND(“/”,
          IF(
              FIND(“www.”, Website) > 0,
              IF(
                  FIND(“//”, Website) > 0,
                  SUBSTITUTE(
                             Website,
                             LEFT(
                                  Website,
                                  FIND(“//www.”, Website) + 5),
                             NULL
                             ),
                  Website
               ),
               IF(
                   FIND(“//”, Website) > 0,
                   SUBSTITUTE(
                       Website,
                       LEFT(
                           Website,
                           FIND(“//”, Website) + 1),
                       NULL),
                   Website
                   )
               )
           ) > 0,
      LEFT(
          IF(
              FIND(“www.”,Website)>0,
              IF(
                  FIND(“//”,Website)>0,
                  SUBSTITUTE(
                      Website,
                      LEFT(
                          Website,
                          FIND(“//www.”,Website) + 5
                      ),
                     NULL),
                  Website
              ),
              IF(
                  FIND(“//”,Website)>0,
                  SUBSTITUTE(
                      Website,
                      LEFT(
                          Website,
                          FIND(“//”,Website) + 1
                      ),
                      NULL
                  ),
                  Website
              )
          ),
          FIND(“/”,
              IF(
                  FIND(“www.”,Website)>0,
                  IF(
                      FIND(“//”,Website)>0,
                      SUBSTITUTE(
                          Website,
                          LEFT(
                              Website,
                              FIND(“//www.”, Website) + 5
                          ),
                          NULL
                     ),
                      Website),
                  IF(
                      FIND(“//”,Website) > 0,
                      SUBSTITUTE(
                          Website,
                          LEFT(
                              Website,
                              FIND(“//”,Website) + 1
                          ),
                          NULL
                      ),
                      Website
                  )
              )
          ) -1
      ),
      IF(
          FIND(“www.”,Website)>0,
          IF(
              FIND(“//”,Website)>0,
              SUBSTITUTE(
                  Website,
                  LEFT(
                      Website,
                      FIND(“//www.”,Website)+5),
                  NULL
              ),
              Website
          ),
          IF(
              FIND(“//”,Website)>0,
              SUBSTITUTE(
                  Website,
                  LEFT(
                      Website,
                      FIND(
                           “//”,
                           Website) + 1
                       ),
                      NULL
              ),
              Website)
      )
  ),
  ‘www.’,
  ”
)

So your formula field looks like this:

This is an important field – it’s what we’ll use to match Leads to Accounts and it can be used to identify duplicate Accounts since this field strips out values like ‘http’ and ‘https’ to only return a ‘clean domain’ (i.e. salesforce.com not http://salesforce.com).

Next, create a very similar field on Leads – but use the email address to create a ‘clean domain’ field instead of website. This will also be a text formula field that looks like this:

SUBSTITUTE(Email, LEFT(Email, FIND(“@”, Email)), NULL)

And the actual field looks like this:

We’ll use the domain field on Leads to match to the domain field on Accounts. We’ll add an additional field on Leads: a Lookup to Account. This is the field we’ll populate with the Account ID when we find a match based on the two domain fields. This is a simple lookup to Account field that looks like this:

Finally, we’ll create a flow that on Lead Create – if the Lead has an Email Address – then match the Lead’s Domain to an Account Domain and if a matching Account is found, set this new Account field on the Lead. Create a Flow that triggers on Leads (I typically just do on Lead Create). The first step in this Flow is to Get Account Records that match the Lead’s Domain:

Next, add a decision step to check if an Account record was found or not:

 

If an Account was found, use the values from this record to set the Account field on the Lead:

(in the above screen-shot, I also set the Company Name so that Company Names are consistent everywhere). After that, just update the Lead with the new values. If I need to backfill to match Leads to Accounts for all records in the Salesforce, I typically do this offline via Dataloader following the same logic: export all Leads with domain, export all Accounts with Domain and Account ID, match Accounts to Leads on domain then bulk update to set the Account field on Leads.

Matching Leads to Accounts in Salesforce is valuable for many reasons and it ensures when looking at an Account in Salesforce you’ll see all ‘people’ related to that Account, not just Contacts.

 

Picture of Scott Ferrebbe Founder of Lighthill CRM in a light blue shirt and dark blue blazer with the top two buttons of the shirt unbuttoned revealing a white undershirt

The 3 best ways I can help you right now...

  1. Click here to schedule a call with one of our CRM Specialists.
  2. Click here to download our CRM Reality Checklist for Sales Superheroes
  3. Follow me on LinkedIn for exclusive tips, how-tos, resources, etc.

Share:

Facebook
Threads
X
LinkedIn
Email

More content...

3 easy steps to a CRM you can trust

Success Call

Share what’s broken and what “good” looks like.

Plan & Build

Get a simple plan to fix processes, data, and connections.

Launch & Win

Go live, trust your dashboards, and hit your numbers.

You’ll move from CRM chaos to predictable performance with one clear source of truth.

Trust your dashboard.
Lead with confidence.

Pick a time that works for you, and get a simple plan to make your CRM match reality.

Complete the form and we’ll get you scheduled for a CRM Success Call.

THANK YOU!

Click on the PDF below to download

Thank You!

We have your message and one of our CRM Specialists will get back to you shortly.