+ Reply to Thread
Results 1 to 2 of 2

display leading zeros in a character string

  1. #1
    Registered User
    Join Date
    02-18-2013
    Location
    Virginia
    MS-Off Ver
    Excel 2007
    Posts
    8

    display leading zeros in a character string

    Hello all,

    I have a code which displays the values of R2, S2, T2, and U2 in one cell (J2). R2, S2 and U2 are all letters, but T2 is a 2 digit number. If there is a leading zero in T2, then in the display of J2, the leading zero is gone. so if the value of R2 is K, S2 is M, T2 is 01 and U2 is S, then I would want it to display KM01S, but it is only displaying KM1S. Thank you for your help and I hope that I have given you enough information!

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

    Re: display leading zeros in a character string

    Do it this way:

    =R2 & S2 & TEXT(T2,"00") & U2

    Hope this helps.

    Pete

+ 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