+ Reply to Thread
Results 1 to 13 of 13

VLOOKUP returns results to left of primary key

  1. #1
    Registered User
    Join Date
    06-19-2017
    Location
    united states
    MS-Off Ver
    2016
    Posts
    12

    VLOOKUP returns results to left of primary key

    I am working on a large spreadsheet and I am using data from column 7 as the primary key but I need to be able to reference info from columns 1-6 is there anyway to display info from the columns to the left of the primary key ?

    Thanks

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VLOOKUP returns results to left of primary key

    You can use INDEX/MATCH rather than VLOOKUP to do that.

    Something like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note, the 0 near the end of the formula forces an exact match. There are other options you could use here depending on the situation.

    Does that help?

    BSB

  3. #3
    Registered User
    Join Date
    06-19-2017
    Location
    united states
    MS-Off Ver
    2016
    Posts
    12

    Re: VLOOKUP returns results to left of primary key

    I've never used index and match I am playing with right now to get it to work...

    Here is the vlookup formula I am using now =VLOOKUP("*"&A3&"*",'Employee Roster'!A:AZ,1,0)

    I am using partial match to return the info I want with the actual data residing on another sheet

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VLOOKUP returns results to left of primary key

    So with that formula you're just looking up the partial match in column A ( on sheet "Employee Roster") and the formula returns the full match from the same column?

    I'm confused as to why you need to look up to the left in that case...?

    BSB

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VLOOKUP returns results to left of primary key

    The formula you gave would be rewritten using INDEX/MATCH like this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    BSB

  6. #6
    Registered User
    Join Date
    06-19-2017
    Location
    united states
    MS-Off Ver
    2016
    Posts
    12

    Re: VLOOKUP returns results to left of primary key

    Yes that is correct, currently, employee name which is located in range a:az on the employee roster is the primary key I am using the employee name to query, but what I need to do is create a second query where query input is not the name, I want to query by the info located in column 7 but also reference info from columns 1-6

    Thank You

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VLOOKUP returns results to left of primary key

    If you need more help to write the INDEX/MATCH formulas then attach a desensitized version of your workbook and we can go from there.

    BSB

  8. #8
    Registered User
    Join Date
    06-19-2017
    Location
    united states
    MS-Off Ver
    2016
    Posts
    12

    Re: VLOOKUP returns results to left of primary key

    See photo ive what I am trying to do and maybe you will have an idea. Thank You query.png

  9. #9
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VLOOKUP returns results to left of primary key

    Which of those cells do you need formulas for and which columns on the Employee Roster sheet pertain to each?
    For example "Employment Status is in column A of Employee Roster sheet"

    BSB

  10. #10
    Registered User
    Join Date
    06-19-2017
    Location
    united states
    MS-Off Ver
    2016
    Posts
    12

    Re: VLOOKUP returns results to left of primary key

    Appreciate your help. all data is on the Employee roster sheet. See below how I have set up

    Employment Status : =VLOOKUP("*"&A3&"*",'Employee Roster'!A:AZ,4,0)
    Locations: =VLOOKUP("*"&A3&"*",'Employee Roster'!A:AZ,9,0)
    Classification: =VLOOKUP("*"&A3&"*",'Employee Roster'!A:AZ,5,0)
    Cubicle: =VLOOKUP("*"&A3&"*",'Employee Roster'!A:AZ,7,0)

    I am trying to create an additional query where I can query someone by the cubcile location, the cubicle is in column 7, and I want to reference the info the columns 1-6 as well as columns 8-15 I am trying to create a table nearly the same as you see but the query will be by location instead of name. If i could figure out how to query by cubicle location and reference employment status I can figure out the rest of the fields.

  11. #11
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VLOOKUP returns results to left of primary key

    So with Employment Status in column D and Cubicle in column G, the below should work. You will need to amend A3 to whichever cell the cubicle number will be entered into to perform the search (if it's not A3 of course!):
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    To look up other details, simply change D:D to whichever column you wish to return a value from. The rest of the formula stays the same.

    BSB

  12. #12
    Registered User
    Join Date
    06-19-2017
    Location
    united states
    MS-Off Ver
    2016
    Posts
    12

    Re: VLOOKUP returns results to left of primary key

    That worked ! Thank You !

  13. #13
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VLOOKUP returns results to left of primary key

    No probs. Happy to help

    BSB

+ 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. VLOOKUP returns #N/A, EXACT returns TRUE
    By mgblair in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-02-2015, 07:37 PM
  2. [SOLVED] When a cell is left blank the formula returns results
    By jendore in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-13-2014, 11:27 AM
  3. VLOOKUP - Returning results x No. of Columns to Left
    By watchouse in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-08-2012, 07:00 AM
  4. [SOLVED] Same Sum Formula Returns Different Results
    By Winon in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-06-2012, 07:07 PM
  5. [SOLVED] Drop-down list connected to functions returns #N/A when left blank
    By m_buskirk in forum Excel General
    Replies: 3
    Last Post: 03-13-2012, 07:15 PM
  6. vlookup returns column to the left
    By Brisbane Rob in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-08-2005, 07:33 PM
  7. [SOLVED] Vlookup and no results with the =left(a1,4) option :)
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2005, 03:06 PM

Tags for this Thread

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