ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   left padding + blank (https://www.excelbanter.com/excel-programming/349635-left-padding-blank.html)

Alex

left padding + blank
 
Hello,

Is it possible to left pad a cell, but only if it's not blank ?

eg,
600 = 00600
50000 = 50000
[blank] = [blank]

(I've just succeeded for non-blank cells)

Thanks in advance.

Peter Beach[_2_]

left padding + blank
 
Hi Alex,

How about selecting the range and setting a custom format of 00000?

Regards,

Peter Beach

"Alex" <. wrote in message
...
Hello,

Is it possible to left pad a cell, but only if it's not blank ?

eg,
600 = 00600
50000 = 50000
[blank] = [blank]

(I've just succeeded for non-blank cells)

Thanks in advance.




Alex

left padding + blank
 
Peter Beach wrote:
Hi Alex,

How about selecting the range and setting a custom format of 00000?

Regards,


Thanks for your answer...
But I don't think I can do that, as the formatted cell is the result of
another cell (a column of cells) in another sheet...

Pete[_26_]

left padding + blank
 
If you are saying that the cell contains a formula which brings a value
from somewhere else, then it doesn't matter - the format of this cell
can be set independently of the other cell(s). Try it, and see if it
does what you want.

If there is a formula in the cell you are trying to format, then the
formula could be modified to give you the effect you are wanting -
please post it here.

Pete


Alex

left padding + blank
 
Pete wrote:

If you are saying that the cell contains a formula which brings a value
from somewhere else, then it doesn't matter - the format of this cell
can be set independently of the other cell(s). Try it, and see if it
does what you want.

If there is a formula in the cell you are trying to format, then the
formula could be modified to give you the effect you are wanting -
please post it here.


It's just something like that : =TEXT(A1;"00###")
For blank cells, I get "00", but I would want the cells to remain blank...

Peo Sjoblom

left padding + blank
 
=IF(A1="";"";TEXT(A1;"00###"))


--

Regards,

Peo Sjoblom

"Alex" <. wrote in message
...
Pete wrote:

If you are saying that the cell contains a formula which brings a value
from somewhere else, then it doesn't matter - the format of this cell
can be set independently of the other cell(s). Try it, and see if it
does what you want.

If there is a formula in the cell you are trying to format, then the
formula could be modified to give you the effect you are wanting -
please post it here.


It's just something like that : =TEXT(A1;"00###")
For blank cells, I get "00", but I would want the cells to remain blank...




Alex

left padding + blank
 
Peo Sjoblom wrote:
=IF(A1="";"";TEXT(A1;"00###"))


Ah yes, thanks... so simple, sorry.


All times are GMT +1. The time now is 12:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com