+ Reply to Thread
Results 1 to 8 of 8

Having issues adding “0” to concatenation

  1. #1
    Registered User
    Join Date
    10-05-2019
    Location
    Colorado
    MS-Off Ver
    11
    Posts
    5

    Having issues adding “0” to concatenation

    Hi, I am trying to concatenate cells.. I have gotten one leading zero taken care of, but when I have two leading zeros I keep getting an error? Can someone look at this and let me know abt I’m messing up?

    =CONCATENATE(LEFT(A2,5),IF(LEN(H2=3,”0”&H2,H2),IF(LEN(I2)=3,”0”&I2,I2, IF(AND(LEN (H2)=2,”0”&H2,H2),IF(LEN(I2)=3,”0”&I2,I2))

  2. #2
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Having issues adding “0” to concatenation

    I think You are simply missing a closing brackey after LEN(H2=3
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Having issues adding “0” to concatenation

    Do you want to ensure that H2 and I2 are both 4 digits in length when concatenated? If so you can do this:

    =LEFT(A2,5)&TEXT(H2,"0000")&TEXT(I2,"0000")

    Your formula seems to be trying to concatenate them twice.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    10-05-2019
    Location
    Colorado
    MS-Off Ver
    11
    Posts
    5
    Quote Originally Posted by Pete_UK View Post
    Do you want to ensure that H2 and I2 are both 4 digits in length when concatenated? If so you can do this:

    =LEFT(A2,5)&TEXT(H2,"0000")&TEXT(I2,"0000")

    Your formula seems to be trying to concatenate them twice.

    Hope this helps.

    Pete
    Hi! That helped... but now the numbers shift left if I have the second set of numbers with three numbers, and the first set four numbers.. is there a way to freeze the positions?

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Having issues adding “0” to concatenation

    I don't understand what this means - perhaps you could explain what you are trying to do in a bit more detail.

    It would help if you attached a sample Excel workbook.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post.

    Don't try to use the Paperclip icon, as it doesn't work on this forum.

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    10-05-2019
    Location
    Colorado
    MS-Off Ver
    11
    Posts
    5

    Re: Having issues adding “0” to concatenation

    Hi, I concatenated two columns with leading zeros, but if the first column has four numbers, and the second column has three numbers and 0, all the numbers shift right and I end up with a zero leading the first four numbers? Does anyone know how to keep the numerals in their proper positions?

    =LEFT(A2,5)&TEXT(H2,"0000")&TEXT(I2,"0000")
    Last edited by Wintchase; 10-07-2019 at 06:03 PM.

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Having issues adding “0” to concatenation

    I believe to get a better formula it would be helpful for you to do what Pete recommended in post #5 and upload a sample workbook.
    What you were given was the best guess based on the formula you showed in post #1 but your descriptions in your posts, I believe, aren't sufficient enough to give you a formula.
    AND, if you upload a sample workbook please make sure you put in sufficient samples AND desired results.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  8. #8
    Registered User
    Join Date
    10-05-2019
    Location
    Colorado
    MS-Off Ver
    11
    Posts
    5

    Re: Having issues adding “0” to concatenation

    Weird... I when I do this formula at work, I get a result like this ABCDE00123478...? When I use my computer in my hotel, it
    works fine.. Any clues? Thanks so much for your patience, and help! I'm a newb..

    using this formula: =(LEFT(A2,5)&TEXT(C2,"0000")&TEXT(D2,"0000"))


    ABCDE1111111 ABCDE12345678 1234 5678
    ABCDE1111112 ABCDE12340678 1234 678
    ABCDE1111113 ABCDE12340078 1234 0078
    Attached Files Attached Files

+ 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] Number rounding and concatenation issues (noob)
    By coolkev99 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-18-2019, 03:06 PM
  2. [SOLVED] Conditional Formatting Issues when adding new rows
    By curdley in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 04-22-2016, 07:28 AM
  3. [SOLVED] Dynamic range issues while adding
    By grkchakri in forum Excel General
    Replies: 7
    Last Post: 01-16-2016, 01:34 AM
  4. Replies: 3
    Last Post: 07-16-2014, 01:50 AM
  5. Replies: 5
    Last Post: 03-11-2013, 04:45 PM
  6. Concatenation issues, multiple cells concatenated to constant text
    By steve777888 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-21-2013, 03:24 AM
  7. Issues with formula when adding/subtracting rows
    By hektisk in forum Excel General
    Replies: 1
    Last Post: 07-21-2011, 11:16 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