+ Reply to Thread
Results 1 to 14 of 14

List using matching criterial of first 5 letters

Hybrid View

  1. #1
    Registered User
    Join Date
    08-22-2011
    Location
    Dubai-UAE
    MS-Off Ver
    Excel 2003
    Posts
    14

    List using matching criterial of first 5 letters

    I have a table as below in Excel sheet 1
    Column1 column5
    Item Name Qty
    ABC179 32000
    XYZ245 308500
    ABC260 355

    I have a table as below in Excel sheet 2
    column3 Column8
    Item Name Qty
    ABC179-adff formula??
    ABC260-ssvs formula??
    XYZ245 - dbvbffbvbdb formula??

    I have detailed name list of the Item in the above format (6 digit code matching Excel sheet 1 and then followed by description) in Sheet 2 and I want the qty details in Sheet 1 to be copied to Sheet 2.FYI: Order also might be changed..

    I would be of great help if any one could give me a solution. thanks in advance..

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: List using matching criterial of first 5 letters

    Please attach a sample workbook with expected output for better understanding


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    08-22-2011
    Location
    Dubai-UAE
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: List using matching criterial of first 5 letters

    I have a table as below in Excel sheet 1
    Column1 column5
    Item Name Qty
    ABC179 32000
    XYZ245 308500
    ABC260 355

    I have a table as below in Excel sheet 2
    column3 Column8
    Item Name Qty
    ABC179-adff formula??
    ABC260-ssvs formula??
    XYZ245 - dbvbffbvbdb formula??

    I have detailed name list of the Item in the above format (6 digit code matching Excel sheet 1 and then followed by description) in Sheet 2 and I want the qty details in Sheet 1 to be copied to Sheet 2.FYI: Order also might be changed..

    Once formula is entered Sheet 2 should look as below.

    Sheet 2

    column3 Column8
    Item Name Qty
    ABC179-adff 32000
    ABC260-ssvs 355
    XYZ245 - dbvbffbvbdb 308500

    It would be of great help if any one could give me a solution. thanks in advance..

  4. #4
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: List using matching criterial of first 5 letters

    Hello,

    You can use this Array formula
    =INDEX(Sheet1!$B$1:$B$3,SMALL(IF(ISNUMBER(SEARCH(Sheet1!$A$1:$A$3,$A1)),ROW(Sheet1!$A$1:$A$3)),ROW($A$1:$A1)))
    You will have to hold Ctrl-Shift and hit Enter to enter the formula (if it's wrapped inside a { }, then you did it right)

    And here is a small sample file with the formula (please prepare them beforehand next time)
    Attached Files Attached Files
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  5. #5
    Registered User
    Join Date
    08-22-2011
    Location
    Dubai-UAE
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: List using matching criterial of first 5 letters

    Thanks, Its working. But could you please tell me the logic for my understanding..

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: List using matching criterial of first 5 letters

    Or

    Formula: copy to clipboard
    =VLOOKUP(TRIM(LEFT(A1,FIND("-",A1)-1)),Sheet1!A:B,2,FALSE)

  7. #7
    Registered User
    Join Date
    08-22-2011
    Location
    Dubai-UAE
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: List using matching criterial of first 5 letters

    Dear
    I tried your formula.It is not working.

    Attached my real sheet for finding the real error.I want in "Sales Order" Sheet Column C, the matching data from "Client Sheet" Column C. Hope we can solve with a small change in logic.
    Attached Files Attached Files

  8. #8
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: List using matching criterial of first 5 letters

    I will break the formula down and how I come up with it

    First, I want to find which row has the text in A1, so I use this Array formula
    IF(ISNUMBER(SEARCH(Sheet1!$A$1:$A$3,$A1)),ROW(Sheet1!$A$1:$A$3))

    What it does is, SEARCH text A1 in every cell from A1 to A3. If it's found, SEARCH will return a number (position in which the text is found), and if it's not found, it will return an error (#VALUE), thus I added an ISNUMBER in front of it (if it returns a number, then TRUE, if not, FALSE). This IF function will then return the row number accordingly (For e.g text in A1 is found in row 1 of sheet1). You can read it like this
    IF ( SEARCH ( text a1, list of text ) , list of rows )

    The second part is SMALL. What this function does is that it will return the 1st, 2nd, ... smallest row among the rows from the IF formula (in case of duplicated data, A1 can be found on more than 1 row for example). The ROW formula at the end will decide whether it will be the 1st row (1st result found), 2nd or 3rd and so on basing on the row number where the formula is currently in.

    The last part is INDEX, basically it will look into a column, then return the number on a specific row (For e.g, Text A1 found on row number 1, then INDEX should return value number 1 from B1 to B3)

    And putting all of that together, you have
    =INDEX(Sheet1!$B$1:$B$3,SMALL(IF(ISNUMBER(SEARCH(Sheet1!$A$1:$A$3,$A1)),ROW(Sheet1!$A$1:$A$3)),ROW($A$1:$A1)))
    In case you don't have duplicated data, I suggest using the formula of Sixthsense, because Array formula is hard to edit and can be resource-consuming.

  9. #9
    Registered User
    Join Date
    08-22-2011
    Location
    Dubai-UAE
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: List using matching criterial of first 5 letters

    Dear
    sixthsense and your formula is not working.

    Attached my real sheet for finding the real error.I want in "Sales Order" Sheet Column C, the matching data from "Client Sheet" Column C
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: List using matching criterial of first 5 letters

    This sample file and the sample file you provided on the other day is reversed ...

    Anyway, here's the sample file with the formula, see if this is what you are looking for.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    08-22-2011
    Location
    Dubai-UAE
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: List using matching criterial of first 5 letters

    Sorry :-) May be this is testing your patience.Still it is not working.Error is coming.

    FYI:Ref attached sheet, I have pasted in Sales order sheet against each row, which data/cell in "Client sheet" to be checked and intended results to come on Column C are shown in Column G for easy understanding.

    for eg: Now when formula entered, I am seeing 32000 in C4 when correct figure was 47450 which is originally in "Client Sheet-C3"

    hope it can be solved...
    Attached Files Attached Files

  12. #12
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: List using matching criterial of first 5 letters

    I'm so sorry, for some reason I miss a -1 ...

    Here is the sample file
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    08-22-2011
    Location
    Dubai-UAE
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: List using matching criterial of first 5 letters

    Dear Lemice,

    I think its working. I am trying it out for various permutations applying big files. Could you pls explain me the logic used/applied here.

    Thanks in advance...

  14. #14
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: List using matching criterial of first 5 letters

    I have explained it on post #7, with just a few change to the formula
    Here is the formula in #7
    =INDEX(Sheet1!$B$1:$B$3,SMALL(IF(ISNUMBER(SEARCH(Sheet1!$A$1:$A$3,$A1)),ROW(Sheet1!$A$1:$A$3)),ROW($A$1:$A1)))
    And here is the one in the most recent attached file
    =IFERROR(INDEX('Client sheet'!$C$2:$C$12,SMALL(IF(ISNUMBER(SEARCH(TRIM('Client sheet'!$A$2:$A$12),$A3)),ROW($A$2:$A$12)-1),1)),"")
    If you ignore the IFERROR in the second formula, they are the same. The only changes I did were changing the cell reference, changing the worksheet, and add a -1 to the ROW formula in the IF because now you have a header row.

+ 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