#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel insists on adding character to formula Pierre Excel Worksheet Functions 5 April 1st 09 08:03 PM
adding up a particular character in a row rkalabokes Excel Discussion (Misc queries) 3 May 9th 07 04:53 PM
Adding a character to a defined name with a formula or macro InfinityDesigns Excel Discussion (Misc queries) 20 June 24th 05 06:36 AM
Adding overscore to character in a cell in an Excell spreadsheet DrJoe Excel Discussion (Misc queries) 0 March 30th 05 04:47 PM
Adding a character to the beginning and end of txt in a cell Duracell Bunnies Excel Worksheet Functions 1 March 18th 05 06:27 PM


All times are GMT +1. The time now is 04:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"