Number Format (custom)

B

barryderay

I want a custom type that will take '5W' and put a zero in front, making it
'05W'. I used the 00 custom type and it would turn 5 into 05. I got a reply
to an earlier post suggesting to use "0"@. This worked but I forgot to
mention that if 05W or 15W was entered I want it left alone. "0"@ added the
zero to the beginning turning it into 005W or 015W.
 
J

Jonathan Cooper

No real way to build logic into a number format in excel.

in a number format you tell it what you want a positive number to look like,
a negative number, zero and text.
 
R

Ron Rosenfeld

I want a custom type that will take '5W' and put a zero in front, making it
'05W'. I used the 00 custom type and it would turn 5 into 05. I got a reply
to an earlier post suggesting to use "0"@. This worked but I forgot to
mention that if 05W or 15W was entered I want it left alone. "0"@ added the
zero to the beginning turning it into 005W or 015W.

If the prefix will always be a "W", you could just enter the number, and use
the custom format:

"00W" (without the quote marks)

Otherwise, you will likely need a VBA event triggered macro so will have to
supply more information.


--ron
 
Top