+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : How to match text and insert corresponding data?

  1. #1
    Registered User
    Join Date
    06-09-2009
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    25

    How to match text and insert corresponding data?

    Attached is a demo excel sheet. Basically I have a list of part numbers (in this case apple and oranges) in a table. I then want to paste in 2 columns. One with the part numbers and one with the number of parts.

    I need to find a way to first match the items in column E to column A. If there is a match the number in column F needs to go in column B. If there is no Match it needs to be "0".

    in the example column B should be 9 for apple, 2 for orange and 0 for kiwi.

    Any help appreciated!
    Attached Files Attached Files
    Last edited by strokedmaro; 06-17-2009 at 11:57 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to match text and insert corresponding data?

    Why 0 for Kiwi ?

    Also you have mix of trailing spaces in the descriptions which will cause the example to fail, I'm presuming these are typos... (ie Apple[space] in A1, Orange[space] in E1 etc...)

    Assuming all are typos (are corrected) and results should be 9,2,4 for Apple, Orange, Kiwi respectively then

    B1: =VLOOKUP(A1,E:F,2,0)
    copied down

    (if you have real issues with leading / trailing spaces you will need to provide a more detailed example I think)

  3. #3
    Registered User
    Join Date
    06-09-2009
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: How to match text and insert corresponding data?

    why "0" for kiwi...

    Well the table will have everything we are supposed to have. Our reports system only prints out part numbers of things that we have 1 or more of.
    If there are 100 part numbers in the table and 10 of those part numbers are 0 then the XML report that prints out will only have 90 part numbers and quantities on it. Hope this helps...(thank you very much for the above solution btw )

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: How to match text and insert corresponding data?

    my point was more the fact that in your sample you did have quantity for Kiwi... to handle the possibility of no match then either:

    a) =IF(ISNA(MATCH(A1,E:E,0)),0,VLOOKUP(A1,E:F,2,0))

    or

    b) =LOOKUP(9.99999999999999E+307,CHOOSE({1,2},0,VLOOKUP(A1,E:F,2,0)))

  5. #5
    Registered User
    Join Date
    06-09-2009
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: How to match text and insert corresponding data?

    Thank you very, very much. Works perfectly!

+ 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