+ Reply to Thread
Results 1 to 8 of 8

Return data to "Main Worksheet" from another worksheet with multiple lookup columns

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    Gainesville, FL
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Return data to "Main Worksheet" from another worksheet with multiple lookup columns

    I have searched the database for something resembling my dilemma and was not able to find or associate anything to what I am needing. Any suggestions or help from this forum would be so greatly appreciated.
    I have a worksheet called "Main Worksheet in which I am needing to return data to columns L and M based on data in data in columns J and K. Below is a visual of what I am referring to:


    Hlookup_search info needed.jpg

    Column J Column K Column L Column M
    City from Sales Line Item State County Name County Code
    OWENSBORO KY
    LOUISVILLE KY
    FLORENCE KY


    The Data I am needing returned is in another worksheet called City_County_Code.
    City_County_Code tab.jpg


    Since the City_County_Code worksheet has all 50 states listed horizontally across the top of the page and each state contains 3 columns. Each column named under each state is "City", "County", "Code".

    I have used Hlookup, Vlookup and Index and Match functions many times before, I am not sure of how the formula should look.


    Bottom line....I am needing to have the cells under Column L and M auto populate based on data in Column K and Column J based of data from the worksheet "City_County_Code"


    Any suggestions would be extremely helpful in getting this project completed. Thank you.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,798

    Re: Return data to "Main Worksheet" from another worksheet with multiple lookup columns

    Why do you need your state data laid out in that fashion? Much better to have it vertically with an extra column for the state designation, then it’s a simple INDEX MATCH situation. You could get the data into the normalised format easily enough.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    01-12-2012
    Location
    Gainesville, FL
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: Return data to "Main Worksheet" from another worksheet with multiple lookup columns

    Thanks for responding so quickly to this...I did consider putting in a vertical mode, I was just trying to minimize the number of rows for the entire worksheet. Not that space is a factor...it is more for the ease of having to work with it when additions need to be made for states that are currently blank. I will try it as a vertical entry and see if I am able to figure out the Index and match function.
    With this file going vertical, how would you write the search function?

    Thank you again for your very quick response to this.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,798

    Re: Return data to "Main Worksheet" from another worksheet with multiple lookup columns

    So, first things first: if you make it vertical and convert it to a table, you can easily add rows and then sort the data as you wish. Then it’s just a case of using a formula like this:

    =LOOKUP(2,1/((state_column=$K2)*(city_column=$J2)),county_column)

  5. #5
    Registered User
    Join Date
    01-12-2012
    Location
    Gainesville, FL
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: Return data to "Main Worksheet" from another worksheet with multiple lookup columns

    Thank you for this. I am in the process of changing to vertical and as soon as I am finished, I will try your suggestion. I will let you know soon. Thanks again

    Pete

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,798

    Re: Return data to "Main Worksheet" from another worksheet with multiple lookup columns

    Looking forward to hearing how it goes when I look in tomorrow morning. Just about to turn in, so goodnight and good luck!

  7. #7
    Registered User
    Join Date
    01-12-2012
    Location
    Gainesville, FL
    MS-Off Ver
    Microsoft 365
    Posts
    80

    Re: Return data to "Main Worksheet" from another worksheet with multiple lookup columns

    Changed the worksheet to a vertical table and the formula you had given me worked perfectly. Thank you so much for your help with this. I certainly appreciate all of the help you all have given me over the years. Take care.

    This answer solved my question.

    SOLVED
    Last edited by pelbert; 01-20-2019 at 06:20 PM.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,798

    Re: Return data to "Main Worksheet" from another worksheet with multiple lookup columns

    Great to know!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Userform checkbox - need to return "Yes" or "No" to worksheet
    By Sparkytech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2018, 06:39 PM
  2. Replies: 7
    Last Post: 04-11-2018, 11:17 PM
  3. Lookup multiple amounts to return "Yes" or "No"
    By pugsly8422 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-24-2017, 01:20 AM
  4. Replies: 6
    Last Post: 06-03-2016, 09:31 PM
  5. Enter Data on "Main" or "Input" Sheet and Copy to One of Many Other Sheets
    By timothy_no7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2012, 07:29 PM
  6. Creating multiple, sorted worksheets from a "main" worksheet using a VBA macro
    By joemtl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2009, 06:30 PM
  7. return data in multiple columns using "if"?
    By JENNYC in forum Excel General
    Replies: 3
    Last Post: 11-07-2005, 03:25 PM

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