+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : How to create a template that automatically populates fields based on lookup table

  1. #1
    Registered User
    Join Date
    01-26-2012
    Location
    australia
    MS-Off Ver
    Excel 2016
    Posts
    27

    How to create a template that automatically populates fields based on lookup table

    Hi,

    Please refer to the attachment. I'd like to create a button that essentially, once pressed, it automatically looks up values (mapped on ID field) against the 'NewCostCode_Lookup' tab and 'Services_lookup' tab. E.g.

    - Field E5 = looks up D5 (Cost Code) maps this against the 'NewCostCode_Lookup' tab and 'Old Value' list, then returns the 'New Value' i.e. 7006
    = Department1/Division1/CostCentre1

    - Field F5 = looks up Jeremy's ID (A5) against 'Services_Lookup' tab and returns the total no. (count) of Services this person is listed against e.g. there are a total of 8 that Jeremy Smith is listed against

    I want to avoid using vlookup everytime but rather just a press of a button will be great (macros perhaps?)

    Thanks.
    Tiggi
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to create a template that automatically populates fields based on lookup tabl

    There is no need for a macro here. Use these formulas...

    B5: =IF($A5="", "", VLOOKUP($A5, Services_Lookup!$B:$D, 2, 0))
    C5: =IF($A5="", "", VLOOKUP($A5, Services_Lookup!$B:$D, 3, 0))
    E5: =IF($D5="", "", VLOOKUP($D5, NewCostCode_Lookup!$A:$B, 2, 0))
    F5: =IF($A5="", "", COUNTIF(Services_Lookup!B:B, $A5))

    Then copy those two cells downward as needed.
    Last edited by JBeaucaire; 02-06-2012 at 02:28 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1