![]() |
adding a character
how do i create a condition on a particular cell if it's characters are less
than 8 it will add a character? e.g. if i put "abcdefg" in my cell, there are only 7 characters in it. the other cell will automatically add a new 1 before the original character so it will become "zabcdefg" which "z" is the character added to make it 8 -- Message posted via http://www.officekb.com |
adding a character
And if it were only 1 character, you'd end up with:
zzzzzzza And if it were empty, leave it empty? =if(a1="","",right(rept("z",8)&a1,8)) This will actually truncate the string at 8 characters. If the original had 1000 characters, the formula will result in the 8 rightmost. "enrico via OfficeKB.com" wrote: how do i create a condition on a particular cell if it's characters are less than 8 it will add a character? e.g. if i put "abcdefg" in my cell, there are only 7 characters in it. the other cell will automatically add a new 1 before the original character so it will become "zabcdefg" which "z" is the character added to make it 8 -- Message posted via http://www.officekb.com -- Dave Peterson |
adding a character
what if there are a lot of characters? i don't want to truncate the other
values. all i want is if my variable inside the cell is less than 8 characters then it will add another one to make it 8 -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200910/1 |
adding a character
On Mon, 26 Oct 2009 00:29:09 GMT, "enrico via OfficeKB.com" <u41845@uwe wrote:
how do i create a condition on a particular cell if it's characters are less than 8 it will add a character? e.g. if i put "abcdefg" in my cell, there are only 7 characters in it. the other cell will automatically add a new 1 before the original character so it will become "zabcdefg" which "z" is the character added to make it 8 Maybe: =REPT("z",MAX(0,8-LEN(A1)))&A1 --ron |
adding a character
Just add another check:
=IF(A1="","",IF(LEN(A1)8,A1,RIGHT(REPT("z",8)&A1, 8))) "enrico via OfficeKB.com" wrote: what if there are a lot of characters? i don't want to truncate the other values. all i want is if my variable inside the cell is less than 8 characters then it will add another one to make it 8 -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200910/1 -- Dave Peterson |
All times are GMT +1. The time now is 08:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com