+ Reply to Thread
Results 1 to 11 of 11

Vlookup function to clean up imported data

  1. #1
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Vlookup function to clean up imported data

    Hello.
    Our company recently encountered a huge problem; every week we get an excel sheet from our supplier with their updated stock list, we then need to check and see what is available from what our customers ordered. The list is extremely long so naturally we use a vlookup function, however, we just noticed that a large amount of the products which are definitely available on the stock list do not work with the vlookup function as the item name doesn't match the lookup value due to a "-" in between characters or a "." and sometimes even leading spaces. I'm sure now you are thinking "Why not just "trim" or "substitute" all the spaces and dashes"? Answer is that i have to submit my order the same way it's on the stock list since the supplier imports it into there database, so if i change the way an item appears in the cell then it will never make it to their system.
    I had an idea that might resolve the issue but i'm not sure if it's at all possible:
    Is there a way to incorporate the trim function and substitute functions into the vlookup function? Meaning the formula will do all the work in cleaning out the stock list without making any changes to it and it will tell me what's available right away.

    I tried having the vlookup function lookup approximate values but the result was way off.

    I'm looking forward to hearing all responses
    Last edited by kosherboy; 11-19-2015 at 02:10 PM.

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Vlookup function to clean up imported data

    YEs - there is - just nest the functions.

    Can you post an example?



    EDIT:

    For just a general example, I put the TRIM and SUBSTITUTE type functions around the lookup-range (I'm using INDEX(MATCH()) instead of VLOOKUP). You would put the 'weird name column' reference inside whatever functions you are looking to used to clean up the names.

    like: TRIM(SUBSTITUTE(A:A,"-",""))


    {=INDEX(FULL_TABLE,MATCH(GOOD_NAME,SUBSTITUTE(TRIM(WEIRD NAME COLUMN WITH BAD TEXT),"-"," "),0),COLUMN YOU WANT)}

    This is an array function - you don't type the { or } - type in the rest and press Cntrl+Shift+Enter - that tells excel this is an array function.
    Last edited by GeneralDisarray; 11-19-2015 at 02:24 PM.
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Vlookup function to clean up imported data

    Is the location of the extra characters predictable?
    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
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Vlookup function to clean up imported data

    Here is an example workbook Example.xlsx
    The dashes and spaces are never predictable.
    Also, a side thing, sometimes the trim and clean functions don't work as the spaces in the item name come from a webpage and would therefore be categorized as a non visible character, i therefore use this formula to remove those stubborn spaces:
    Please Login or Register  to view this content.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Vlookup function to clean up imported data

    OK so which - if either - list can you modify/add to?

  6. #6
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Vlookup function to clean up imported data

    Quote Originally Posted by GeneralDisarray View Post
    YEs - there is - just nest the functions.


    EDIT:
    For just a general example, I put the TRIM and SUBSTITUTE type functions around the lookup-range (I'm using INDEX(MATCH()) instead of VLOOKUP). You would put the 'weird name column' reference inside whatever functions you are looking to used to clean up the names.
    like: TRIM(SUBSTITUTE(A:A,"-",""))
    {=INDEX(FULL_TABLE,MATCH(GOOD_NAME,SUBSTITUTE(TRIM(WEIRD NAME COLUMN WITH BAD TEXT),"-"," "),0),COLUMN YOU WANT)}
    Dear GeneralDisarray,
    Thank you for the formula example.
    I'm having trouble working your formula with my example workbook, can you post the formula again using the example workbook?

  7. #7
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Vlookup function to clean up imported data

    Quote Originally Posted by FDibbins View Post
    OK so which - if either - list can you modify/add to?
    Hi FDibbens,
    I would like to modify the stock list, not my order list.

  8. #8
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Vlookup function to clean up imported data

    Sure.

    THis is the array formula I used (see attached)>
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Vlookup function to clean up imported data

    Works amazing! Thanks!
    All the best!

  10. #10
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Vlookup function to clean up imported data

    Dear GeneralDisarray,
    i have no words, you really helped us out
    I appreciate your help very much

  11. #11
    Valued Forum Contributor
    Join Date
    11-27-2013
    Location
    Brooklyn, NY
    MS-Off Ver
    Office 365
    Posts
    1,172

    Re: Vlookup function to clean up imported data

    Quote Originally Posted by GeneralDisarray View Post
    Sure.

    THis is the array formula I used (see attached)>
    Please Login or Register  to view this content.
    Hi again.
    I feel bad making you crazy but it seems the formula will not work if the lookup value is just a plain number?
    Is there any way to modify this complex formula to include numbers?

+ 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 data mismatch for Imported CSV
    By dineshsachidananda in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 06-12-2014, 06:57 AM
  2. VLOOKUP - AVERAGE on Imported XML data
    By hditano in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-13-2013, 06:21 PM
  3. How to Clean an Imported Text file with VBA
    By zaska in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-17-2013, 07:07 AM
  4. [SOLVED] VBA Code to optimize and clean data- clean out numerical/ or symbol
    By tracylsr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2012, 04:21 PM
  5. Clean function combined with VLOOKUP
    By Nathalie1974 in forum Excel General
    Replies: 3
    Last Post: 02-23-2012, 07:53 PM
  6. Clean Function to Clean Entire Sheet
    By gema in forum Excel General
    Replies: 7
    Last Post: 11-05-2009, 10:07 AM
  7. VLookup problem-Is the data imported, especially from a website?
    By Alan in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-06-2005, 07:05 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