+ Reply to Thread
Results 1 to 3 of 3

Concatenating leading zeroes and VLOOKUP

  1. #1
    Registered User
    Join Date
    09-09-2011
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2003
    Posts
    2

    Concatenating leading zeroes and VLOOKUP

    Hi all, I've got a problem that feels like it should be simple to rectify but I can't for the life of me think how to do it.

    I have a list of item codes ranging between 1 and 9999. I am trying to use VLOOKUP to get data from spreadsheet A and populate fields in spreadsheet B. In spreadsheet A the item codes do not having lead zeroes (e.g. 1234) but in spreadsheet B they do have leading zeroes (e.g. 01234).

    I have used Concatenate in Spreadsheet A to add a zero to the start of each item code, and this works fine for numbers between 1000 and 9999.

    However this means that item codes from 1 to 999 do not have the correct number of zeroes. Using CONCATENATE("0",A1) will for example return 03456 and 07890 correctly, but it returns 01, 023, 0345 for instance when dealing with shorter strings.

    Is there a formula that I can use that will change the data in spreadsheet A into a five-digit number, adding leading zeroes as appropriate?

    Thanks for reading.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Concatenating leading zeroes and VLOOKUP

    =text(a1,"00000")

  3. #3
    Registered User
    Join Date
    09-09-2011
    Location
    Cardiff, Wales
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Concatenating leading zeroes and VLOOKUP

    Excellent, thank you very much for the quick reply!

+ 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