+ Reply to Thread
Results 1 to 16 of 16

VLOOKUP help please

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-04-2015
    Location
    Dallas,Texas
    MS-Off Ver
    excel 2013
    Posts
    191

    VLOOKUP help please

    I am trying to look up the master codes in the "List" sheet and put the results into column D in the "Master" sheet. The criteria are that Category and Event need to match Primary Catergory and Event_Name in the "List" sheet.

    Thank you.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: VLOOKUP help please

    This in D2 on the master sheet should work for you:
    =INDEX(List!$A$1:$A$623,MATCH(1,INDEX((List!$B$1:$B$623=Master!A2)*(List!$C$1:$C$623=Master!B2),0),0))
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

  3. #3
    Forum Contributor
    Join Date
    02-04-2015
    Location
    Dallas,Texas
    MS-Off Ver
    excel 2013
    Posts
    191

    Re: VLOOKUP help please

    Quote Originally Posted by nigelbloomy View Post
    This in D2 on the master sheet should work for you:
    =INDEX(List!$A$1:$A$623,MATCH(1,INDEX((List!$B$1:$B$623=Master!A2)*(List!$C$1:$C$623=Master!B2),0),0))
    Can you please walk me through your formula and logic? I have never used INDEX and MATCH functions before :p

    Also for some values I am getting N/A I guess it might be because some of the event values don't match up fully

  4. #4
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: VLOOKUP help please

    Give this formula a try.

    =IF(SUMPRODUCT(--(List!$B$1:$B$623=Master!A2),--(List!$C$1:$C$623=Master!B2),List!$A$1:$A$623)=0, "",SUMPRODUCT(--(List!$B$1:$B$623=Master!A2),--(List!$C$1:$C$623=Master!B2),List!$A$1:$A$623))

  5. #5
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.92 (24120731))
    Posts
    9,108

    Re: VLOOKUP help please

    enter
    =INDEX(List!A:A,MATCH(A2&B2,List!B:B&List!C:C,0))
    as an array formula
    Using Control + Shift + enter
    to get
    {=INDEX(List!A:A,MATCH(A2&B2,List!B:B&List!C:C,0))}

    you can change the A:A and B:B and C:C to an actual range you are likely to use - that would be better
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  6. #6
    Forum Contributor
    Join Date
    02-04-2015
    Location
    Dallas,Texas
    MS-Off Ver
    excel 2013
    Posts
    191

    Re: VLOOKUP help please

    I can do the N/A ones manually I guess

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: VLOOKUP help please

    There are many errors between the worksheets. These errors result in #N/A.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  8. #8
    Forum Contributor
    Join Date
    02-04-2015
    Location
    Dallas,Texas
    MS-Off Ver
    excel 2013
    Posts
    191

    Re: VLOOKUP help please

    Quote Originally Posted by newdoverman View Post
    There are many errors between the worksheets. These errors result in #N/A.
    This will work thanks! I will fix the N/As myself. Since I am new to the formulas of INDEX and MATCH function can you please walk me through your logic and formula please?

    Thank you.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: VLOOKUP help please

    I nwould always go for the formula suggested by nigelbloomy. But. None of the above have pointed out the fact that many errorsare returned, because the phrases dont match exactly.

    Order Denying Application For Legal And Administrative Fees And Expenses in master B5, is not the same as
    Order Denying Application For Legal, Administrative Fees And Expenses in List C47.

    You'll have to iron out those inconsistencies, first, before this will work.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  10. #10
    Forum Contributor
    Join Date
    02-04-2015
    Location
    Dallas,Texas
    MS-Off Ver
    excel 2013
    Posts
    191

    Re: VLOOKUP help please

    Quote Originally Posted by Glenn Kennedy View Post
    I nwould always go for the formula suggested by nigelbloomy. But. None of the above have pointed out the fact that many errorsare returned, because the phrases dont match exactly.

    Order Denying Application For Legal And Administrative Fees And Expenses in master B5, is not the same as
    Order Denying Application For Legal, Administrative Fees And Expenses in List C47.

    You'll have to iron out those inconsistencies, first, before this will work.
    You're right I will fix those up.

  11. #11
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: VLOOKUP help please

    =INDEX(List!$A$1:$A$623,MATCH(1,INDEX((List!$B$1:$B$623=Master!A2)*(List!$C$1:$C$623=Master!B2),0),0))
    The first index creates a list of all of the values in column A on the List sheet. Now it just needs to someone to tell it which row number to pick.

    Match will find the first row number that matches the value of 1 from a list of values.

    The next index creates that list of values for match to pick from. First it takes all of the values in column B and tells you True or False if they are equal to the value in A2. Then it finds all of the values in column C and tells you true or false if they match the value in B2. Then it multiplies these two results together. If they are both true, it shows up as True, if either one or both are false, then it turns into false. The cool part if that true is the same as 1 and false is the same as 0. So match will find the first time a row number is true for both criteria and give that row number back to the first Index list.

    Now the first index knows which row to tell you, and it gives you the master code that matches.

  12. #12
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: VLOOKUP help please

    The formula that I used was an ARRAY formula which is entered with Ctrl + Shift + Enter.
    Formula: copy to clipboard
    =INDEX(List!$A$3:$A$621,MATCH(Master!A2&Master!B2,List!$B$3:$B$621&List!$C$3:$C$621,0))


    The INDEX part of the formula is in simple terms the data that you want to find. The INDEX function actually returns the value found at the intersection of a row and column. INDEX(List!$a$3:$a$621 indicates the column from which we want to retrieve data.

    The MATCH part of the formula is going to give the row from which to retrieve data. Seeing that the criteria is actually two parts (Master column A and Master column B) the two parts are combined with the & which concatenates or joins the cells referenced together to be treated as if it was 1 unit. MATCH(Master!A2&Master!B2 is what we are actually going to search the List worksheet for in columns B and C. ,List!$B$3:$B$621&List!$C$3:$C$621 are the columns B and C on the List worksheet that have been "joined" with the & sign and this will allow both columns to be treated as a single column for the formula. So, now we have the two criteria joined and an array of two columns that have been joined in which the search for the criteria will take place. The next element in the formula is 0. 0 is the same as FALSE. This means that we want an exact match. When a match of the criteria is found in the array, the value in the INDEX column on the same row is returned.

    The same results can be obtained by using helper columns on both the Master and List worksheets that combine the criteria and the array columns. On the Master worksheet the helper column would have =A2&B2 entered in the helper column (column E)an filled down, and the List worksheet would have in column D =B2:C2 and filled down.

    The formula to retrieve the data would then be =INDEX(List!$A$3:$A$621,MATCH(E2,List!$D$3:$D$621,0)) filled down.

    There are non-array formulae to extract the data. nigelbloomy supplied one:
    =INDEX(List!$A$1:$A$623,MATCH(1,INDEX((List!$B$1:$B$623=Master!A2)*(List!$C$1:$C$623=Master!B2),0),0))

    This formula starts off the same as the Array formula with the INDEX which serves the same purpose.
    The MATCH part is different. Here the MATCH value is 1 which seems strange but next part will make use of that 1. The ARRAY part of the MATCH function is being dealt with by the INDEX function containing the multiplication of the two columns on the list worksheet that were joined together in the array formula above. This multiplication produces a series of 1s and 0s. The 1s are matches and the 0s are non matches. So MATCH is actually matching 1 with 1 in the calculated array.

    I hope that this satisfies your query.

  13. #13
    Forum Contributor
    Join Date
    02-04-2015
    Location
    Dallas,Texas
    MS-Off Ver
    excel 2013
    Posts
    191

    Re: VLOOKUP help please

    Quote Originally Posted by newdoverman View Post
    The formula that I used was an ARRAY formula which is entered with Ctrl + Shift + Enter.
    Formula: copy to clipboard
    =INDEX(List!$A$3:$A$621,MATCH(Master!A2&Master!B2,List!$B$3:$B$621&List!$C$3:$C$621,0))


    The INDEX part of the formula is in simple terms the data that you want to find. The INDEX function actually returns the value found at the intersection of a row and column. INDEX(List!$a$3:$a$621 indicates the column from which we want to retrieve data.

    The MATCH part of the formula is going to give the row from which to retrieve data. Seeing that the criteria is actually two parts (Master column A and Master column B) the two parts are combined with the & which concatenates or joins the cells referenced together to be treated as if it was 1 unit. MATCH(Master!A2&Master!B2 is what we are actually going to search the List worksheet for in columns B and C. ,List!$B$3:$B$621&List!$C$3:$C$621 are the columns B and C on the List worksheet that have been "joined" with the & sign and this will allow both columns to be treated as a single column for the formula. So, now we have the two criteria joined and an array of two columns that have been joined in which the search for the criteria will take place. The next element in the formula is 0. 0 is the same as FALSE. This means that we want an exact match. When a match of the criteria is found in the array, the value in the INDEX column on the same row is returned.

    The same results can be obtained by using helper columns on both the Master and List worksheets that combine the criteria and the array columns. On the Master worksheet the helper column would have =A2&B2 entered in the helper column (column E)an filled down, and the List worksheet would have in column D =B2:C2 and filled down.

    The formula to retrieve the data would then be =INDEX(List!$A$3:$A$621,MATCH(E2,List!$D$3:$D$621,0)) filled down.

    There are non-array formulae to extract the data. nigelbloomy supplied one:
    =INDEX(List!$A$1:$A$623,MATCH(1,INDEX((List!$B$1:$B$623=Master!A2)*(List!$C$1:$C$623=Master!B2),0),0))

    This formula starts off the same as the Array formula with the INDEX which serves the same purpose.
    The MATCH part is different. Here the MATCH value is 1 which seems strange but next part will make use of that 1. The ARRAY part of the MATCH function is being dealt with by the INDEX function containing the multiplication of the two columns on the list worksheet that were joined together in the array formula above. This multiplication produces a series of 1s and 0s. The 1s are matches and the 0s are non matches. So MATCH is actually matching 1 with 1 in the calculated array.

    I hope that this satisfies your query.
    Quick Questions I understand your formula but why do you have to do CTRL SHIFT ENTER? what does that do to the formula?

    Thanks

  14. #14
    Forum Contributor
    Join Date
    02-04-2015
    Location
    Dallas,Texas
    MS-Off Ver
    excel 2013
    Posts
    191

    Re: VLOOKUP help please

    Great work!! and great explanations! this was hardcore. . .I am trying to understand this I will be in touch if I have any other questions.

    Thanks!

  15. #15
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: VLOOKUP help please

    An array formula will return values that would not normally be returned in a single cell like series of cells being calculated against other series of cells. If not entered with Ctrl + Shift + Enter the formula would not be an array formula an error or an inappropriate value that would be returned.

    NOTE:

    Don't quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding.

  16. #16
    Forum Contributor
    Join Date
    02-04-2015
    Location
    Dallas,Texas
    MS-Off Ver
    excel 2013
    Posts
    191

    Re: VLOOKUP help please

    Thanks again for the explanation! and yes I agree it makes it more ambiguous what we are talking about if I just select the entire quote.

    I am marking the thread as solved.

+ 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. Using vLookup based on results from a vLookup & returning an undetermined list
    By NormalityBan in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 08-14-2014, 05:02 AM
  2. Replies: 0
    Last Post: 12-26-2013, 01:12 PM
  3. Display Cell within VLookup range that excel thinks matches the VLookup Value
    By headachexcelperson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-04-2013, 04:56 PM
  4. vlookup? match? index? MULTIPLE criteria for vlookup search problem....
    By aborg88 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-11-2013, 09:56 AM
  5. Replies: 5
    Last Post: 07-29-2009, 07:53 AM

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