+ Reply to Thread
Results 1 to 9 of 9

Index & Match Look-Up

  1. #1
    Registered User
    Join Date
    11-17-2016
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    24

    Index & Match Look-Up

    Hi There...

    I am trying to solve a lookup of a particular value but the database has more than one row of which the lookup value is the same. On the attached workbook the commodity code is entered in the yellow cell. The blue cells then needs to return the relevant values (which I have typed in manually to show the required answer) by looking them up on the two relevant SQL Tables called "InvMaster" & "BomStructure" and in one case it also needs to change the letter "S" to the word "Bay" in front of the numerical number i.e. S103 must be Bay 103.

    Any help would be appreciated as I am not getting the Index & Match to work correctly.

    Thank You
    Colin
    Attached Files Attached Files
    Last edited by Colin Smitie; 04-24-2017 at 05:37 AM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,151

    Re: Index & Match Look-Up

    I think you need to add more examples to avoid us making assumptions: how the we know which components are "cores" unless they always start with "32"?

  3. #3
    Registered User
    Join Date
    11-17-2016
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    24

    Re: Index & Match Look-Up

    Quote Originally Posted by JohnTopley View Post
    I think you need to add more examples to avoid us making assumptions: how the we know which components are "cores" unless they always start with "32"?
    Hi John,

    All the data works in the same manner whereby the "cores" will always start with "32-" and ends with a "-1" etc depending how many different types of cores. (Could be up to 7 types) The only thing differentiating them from each other is the numerical number in the middle that will always be the same as the commodity code typed in the yellow cell i.e. 31-20050033-1; 31-20050033-2; 31-20050033-3 etc. up to -7 if there are 7 types of cores.
    Last edited by Colin Smitie; 04-24-2017 at 08:55 AM.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,151

    Re: Index & Match Look-Up

    Colin,
    Formulae are in column C:

    in C2

    =SUBSTITUTE(INDEX(BomStructure!$F$2:$F$21,MATCH(1,(BomStructure!$A$2:$A$21=Sheet1!$B$1)*(LEFT(BomStructure!$F$2:$F$21,1)="S")*(ISNUMBER((MID(BomStructure!$F$2:$F$21,2,1)+0))),0)),"S","Bay")

    in C3 and copy down

    =IFERROR(INDEX(BomStructure!$F$2:$F$21,SMALL(IF((BomStructure!$A$2:$A$21=InvMaster!$A$2)*(LEFT(BomStructure!$F$2:$F$21,2)="32"),ROW(BomStructure!$F$2:$F$21)-ROW($F$2)+1,""),ROWS($F$2:F2))),"")

    in C10

    =IFERROR(INDEX(BomStructure!$F$2:$F$21,SMALL(IF((BomStructure!$A$2:$A$21=InvMaster!$A$2)*(LEFT(BomStructure!$F$2:$F$21,1)="4"),ROW(BomStructure!$F$2:$F$21)-ROW($F$2)+1,""),ROWS($F$2:F2))),"")

    in C11

    =IFERROR(INDEX(BomStructure!$F$2:$F$21,SMALL(IF((BomStructure!$A$2:$A$21=InvMaster!$A$2)*(LEFT(BomStructure!$F$2:$F$21,1)="7"),ROW(BomStructure!$F$2:$F$21)-ROW($F$2)+1,""),ROWS($F$2:F2))),"")

    All the above are array-formulae so ...


    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    If there is a variable number of items for C3, C10 and C11 then there is problem of how to handle these wihout leaving blanks lines.

    If C10 and C11 are single items then consider moving them C2 (Work Centre).
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-17-2016
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    24

    Re: Index & Match Look-Up

    Hi John,

    Thank you for the help thus far. I see the formulae for C2 is working perfectly. Thank you! However the formulas in the other cells from C3-C11 do not change the value when the commodity code in B1 changes. I have added a second item into the database for reference. If the commodity code is changed from 20050033 to 20090078 the work centre (in cell C2) changes correctly. But the Core numbers do not change as there is no reference to the cell B2. All the changes on the cells need to always refer to the entry done in B2. See attached workbook with an extra set of data loaded.
    Attached Files Attached Files
    Last edited by Colin Smitie; 04-25-2017 at 01:28 AM.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,151

    Re: Index & Match Look-Up

    Must have had a senior moment ...

    in C3

    =IFERROR(INDEX(BomStructure!$F$2:$F$1048576,SMALL(IF((BomStructure!$A$2:$A$1048576=Sheet1!$B$1)*(LEFT(BomStructure!$F$2:$F$1048576,2)="32"),ROW(BomStructure!$F$2:$F$1048576)-ROW($F$2)+1,""),ROWS($F$2:F2))),"")

    in C10

    =IFERROR(INDEX(BomStructure!$F$2:$F$21,SMALL(IF((BomStructure!$A$2:$A$21=B1)*(LEFT(BomStructure!$F$2:$F$21,1)="4"),ROW(BomStructure!$F$2:$F$21)-ROW($F$2)+1,""),ROWS($F$2:F2))),"")

    in C11

    =IFERROR(INDEX(BomStructure!$F$2:$F$21,SMALL(IF((BomStructure!$A$2:$A$21=B1)*(LEFT(BomStructure!$F$2:$F$21,1)="7"),ROW(BomStructure!$F$2:$F$21)-ROW($F$2)+1,""),ROWS($F$2:F2))),"")

    And range maximum to something sensible as I assume you don't have 1 million + rows.

  7. #7
    Registered User
    Join Date
    11-17-2016
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    24

    Re: Index & Match Look-Up

    Hi John,

    Appology on the delayed response. Thank you for the help. The Index & Matc Look-Up works perfect! I will mark the thread as solved.

    Greetings
    Colin

  8. #8
    Registered User
    Join Date
    11-17-2016
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    24

    Re: Index & Match Look-Up

    Quote Originally Posted by JohnTopley View Post
    Must have had a senior moment ...

    in C3

    =IFERROR(INDEX(BomStructure!$F$2:$F$1048576,SMALL(IF((BomStructure!$A$2:$A$1048576=Sheet1!$B$1)*(LEFT(BomStructure!$F$2:$F$1048576,2)="32"),ROW(BomStructure!$F$2:$F$1048576)-ROW($F$2)+1,""),ROWS($F$2:F2))),"")

    in C10

    =IFERROR(INDEX(BomStructure!$F$2:$F$21,SMALL(IF((BomStructure!$A$2:$A$21=B1)*(LEFT(BomStructure!$F$2:$F$21,1)="4"),ROW(BomStructure!$F$2:$F$21)-ROW($F$2)+1,""),ROWS($F$2:F2))),"")

    in C11

    =IFERROR(INDEX(BomStructure!$F$2:$F$21,SMALL(IF((BomStructure!$A$2:$A$21=B1)*(LEFT(BomStructure!$F$2:$F$21,1)="7"),ROW(BomStructure!$F$2:$F$21)-ROW($F$2)+1,""),ROWS($F$2:F2))),"")

    And range maximum to something sensible as I assume you don't have 1 million + rows.
    Hi John,

    Although this thread have been marked as solved there is more problems that I have to overcome which I did not originally foresee. Do I need to post a new thread for below or can we continue on this one? Due to the complexity of the lookups I am trying to achive I knew that you would know how to do it.

    On the attached workbook I am trying to get the formula to work for the following cells on sheet1:
    Cell C12 will need to look for a value that will always have a "D-" in front of it based on the entry in cell B1.
    Cell C13 will need to look for a value that will always have a "32-3" in front of it. (Core Irons will always have a "32-3" in front of it. Cores that you solved in the lookup for cells C3 to C9 always has a "32-2" in front of it.)

    Then I also need to return the qty for each of the items (cells C3 to C13) based on the original commodity code entered into cell B1. The value of the qty is located in database called "BommStructure" in column M called "QtyPer".
    Attached Files Attached Files
    Last edited by Colin Smitie; 05-11-2017 at 01:42 AM.

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,151

    Re: Index & Match Look-Up

    There is no data for "Ceramic Inserts"; and as the "Core Irons" are not related to the "Parent" then, if there is more than one "set" of data in "Bom Structure", there is no way of relating the "Core Iron" to the correct parent. Searching on "D" will always find the first in any list.

    in C12

    =IFERROR(INDEX(BomStructure!$F$2:$F$31,SMALL(IF((LEFT(BomStructure!$F$2:$F$31,1)="D"),ROW(BomStructure!$F$2:$F$31)-ROW($G$2)+1,""),ROWS($G$2:G2))),"")

    in C13

    =IFERROR(INDEX(BomStructure!$F$2:$F$31,SMALL(IF((LEFT(BomStructure!$F$2:$F$31,4)="32-3"),ROW(BomStructure!$F$2:$F$31)-ROW($G$2)+1,""),ROWS($G$2:G2))),"")


    in D3

    =INDEX(BomStructure!$M$2:$M$31,MATCH($B$1&$C3,BomStructure!$A$2:$A$31&BomStructure!$F$2:$F$31,0))

    ALL entered with Ctrl+Shift+Enter
    Last edited by JohnTopley; 05-11-2017 at 04:54 AM.

+ 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] INDEX+MATCH instead of VLOOKUP+MATCH, why is INDEX a better choice and how to re-write?
    By Renejorgensen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-23-2016, 10:54 AM
  2. [SOLVED] Index / Match - match 3 input values and return the results from the index
    By t83357 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-08-2016, 07:34 PM
  3. [SOLVED] Match-Index in stead of Index-Match lookup Array among Arrays
    By Numnum in forum Excel General
    Replies: 2
    Last Post: 10-15-2015, 02:08 PM
  4. INDEX MATCH MATCH/OFFSET MATCH MATCH with named ranges
    By Andrew-Mark in forum Excel General
    Replies: 3
    Last Post: 02-27-2015, 10:56 PM
  5. Replies: 6
    Last Post: 04-30-2014, 02:42 AM
  6. Replies: 6
    Last Post: 11-08-2013, 10:29 PM
  7. Replies: 3
    Last Post: 05-02-2013, 01:31 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