+ Start a Discussion
Akash ZaveriAkash Zaveri 

VLOOKUP salesforce information in Excel

How do I populate my Excel spreadsheet with specific information (e.g. First Name, Last Name, E-mail) given an Account Name in column A?
anand k 11anand k 11
Hi Akash,

Here's the link to the SFDC doc on VLOOKUP() which has descriptions and examples.  
https://help.salesforce.com/htviewhelpdoc?id=customize_functions_i_z.htm&siteLang=en_US#VLOOKUP

https://success.salesforce.com/answers?id=90630000000gyFzAAI

I got below trigger from developer forum hope this will help you


trigger AnyName on ObjectA (before insert, before update) {
    for (ObjectA responseInLoop : trigger.new) {
        if (responseInLoop.fieldA1 != NULL) {
        List<ObjectB> values = [SELECT fieldB2 FROM ObjectB WHERE fieldB1 = :responseInLoop.fieldA1];
            if (values.size() > 0) {
                responseInLoop.fieldA2 = scores[0].fieldB2;}
            Else {responseInLoop.Q1_Percentile__c = NULL;}}
        Else {responseInLoop.Q1_Percentile__c = NULL;}
    }
}

For clarity, I've used A and B to refer to the two objects, and 1 and 2 to the fields on each object (thus the field to return on Object B is easily identified as fieldB2). 

The code checks to see if A1 is empty, if not, return values of B2 where B1 = A1, and then sets A2 = to B2. If A1 is empty or does not return any B records, nothing happens. Hope this helps anyone with similar needs!

Thanks
Anand
sfdcdevsfdcdev
Watch this video to understand how to use vlookup in excel:

http://salesforce.vidyard.com/watch/Te2Qxd1MsJt4jTnlxRiMoA