• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Field length 14 digits long with the end 4 characters static

CLoos

New Member
I am trying to update a field so it is always 14 digits long. The issue I am having is the first 10 digits need to have a trailing space to equate to 10 digits without moving the last 4 characters so in total it is always 14 digits long. Example below. I played around with the left/len formula without success.

1111111111bb01
111bb01
111111bb01
11111bb01
1111111111bb01
11111111bb01
111111111bb01
 
I should have been more clear. The numbers can have a mix of letters and I need it to have spaces between the standard stock number and the trailing 4 alpha/numeric identifier. Is it possible? The example above collapsed my numbers together perhaps this picture is a better representation.

upload_2018-3-4_11-44-14.png
 
I should have been more clear. The numbers can have a mix of letters and I need it to have spaces between the standard stock number and the trailing 4 alpha/numeric identifier. Is it possible? The example above collapsed my numbers together perhaps this picture is a better representation.

View attachment 50421

upload_2018-3-5_16-28-47.png

In B1, copied down :

=REPLACE(A1,MIN(FIND({1,2,3,4}+{0;5},A1&1/17)),,REPT("0",14-LEN(A1)))

Regards
Bosco
 
I think it should be this mess
upload_2018-3-5_18-17-7.png

B2: =LEFT(A2,MIN(10,IFERROR(FIND(" ",A2),LEN(LEFT(A2,LEN(A2)-4)))))&REPT("-",10-MIN(10,LEN(LEFT(A2,IFERROR(FIND(" ",A2),LEN(LEFT(A2,LEN(A2)-4)))))))&RIGHT(A2,4)

Change the "-" for a space
 
upload_2018-3-5_18-33-7.png

As per post #.7 Hui's data layout, in B2 copied down :

=REPLACE(A2,LEN(A2)-3,,REPT("0",14-LEN(A2)))

Change the "0" for a space

Regards
Bosco
 
Last edited:
Back
Top