+ Start a Discussion
Gary HammellGary Hammell 

VLookup in Salesforce?

Hi all, I'd like to have a formula field that populates with a name based off of the zip code on a Contact record.  The idea is that a Senator or Legislator name would be populated based off of a zip code.  I'm imagining something like a VLookup in Excel, but in Salesforce.  It's out of the question to write a huge nested conditional formula to pull the info.  Is there any way to store something in Salesforce that can be updated, that a formula field can reference to pull information from, similiar to an excel VLookup?

Thanks!
Best Answer chosen by Gary Hammell
PratikPratik (Salesforce Developers) 
Hi Garry,

Please refer to this post:
https://success.salesforce.com/answers?id=90630000000gyFzAAI

Thanks,
Pratik

All Answers

PratikPratik (Salesforce Developers) 
Hi Garry,

Please refer to this post:
https://success.salesforce.com/answers?id=90630000000gyFzAAI

Thanks,
Pratik
This was selected as the best answer
Gary HammellGary Hammell
Hi Pratik - thanks for the info.  However, it seems a limitation of this is that the VLOOKUP function is only available within validation rules.  That isn't sufficient for my problem at hand.  I'm not trying to validate an input.  I'm trying to automate filling in a field with a specific Legislator name based off of a zip code.  Basically, a VLOOKUP without the restriction that it must be within a validation rule.  Is there any way of doing this?

Thanks again!
SteveMoSteveMo
For that you're probably gonna need Apex Code, it's not possible using an SFDC Formula, or Formula Field
Susan Harris 6Susan Harris 6
I am really late to the game here, but in case there is still a need here:

If you have a custom object for Legislator and the Legislator record has a zip code field, you could use Lookup Helper to automatically populate the lookup field on the Contact record based on the Billing Zip of the Account/Contact. Lookup Helper can be installed free from the AppExchange: https://goo.gl/LvaVlk

Full disclosure, I work for Passage Technology - the makers of Lookup Helper.