ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Number Format (https://www.excelbanter.com/excel-discussion-misc-queries/47639-number-format.html)

LoganStallworth

Number Format
 

Is there a way I can format a number so that significant 0's and a
letter are conditional?

I currently use:

?0"g" ?0"s" ?0"c" - which formats like so:

100000 = 10g 00s 00c
100010 = 10g 00s 10c
1000 = 0g 10s 00c


What I wish to have is a code that formats like so:

101010 = 10g 10s 10c
10000 = 10s
10 = 10c
100010 = 10g 10c


Is this possible?


--
LoganStallworth
------------------------------------------------------------------------
LoganStallworth's Profile: http://www.excelforum.com/member.php...o&userid=27561
View this thread: http://www.excelforum.com/showthread...hreadid=471534


Bob Phillips

Try a format of

[9999]0"g "00"s "00"c";[99]00"s "00"c";0"c"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"LoganStallworth"
<LoganStallworth.1w34uc_1127937906.0147@excelfor um-nospam.com wrote in
message news:LoganStallworth.1w34uc_1127937906.0147@excelf orum-nospam.com...

Is there a way I can format a number so that significant 0's and a
letter are conditional?

I currently use:

?0"g" ?0"s" ?0"c" - which formats like so:

100000 = 10g 00s 00c
100010 = 10g 00s 10c
1000 = 0g 10s 00c


What I wish to have is a code that formats like so:

101010 = 10g 10s 10c
10000 = 10s
10 = 10c
100010 = 10g 10c


Is this possible?


--
LoganStallworth
------------------------------------------------------------------------
LoganStallworth's Profile:

http://www.excelforum.com/member.php...o&userid=27561
View this thread: http://www.excelforum.com/showthread...hreadid=471534




LoganStallworth


That works very well. I appreciate it, but may I ask for one more
thing.

I now know that you can use ; and [] for something of an if/then
statement, but how do I do something that will not put 00c, but will
put 10c if there is something in the ten and ones place?


--
LoganStallworth
------------------------------------------------------------------------
LoganStallworth's Profile: http://www.excelforum.com/member.php...o&userid=27561
View this thread: http://www.excelforum.com/showthread...hreadid=471534


LoganStallworth


Also. Why is it that

[9999]0"g "00"s "00"c";[99]00"s" 00"c";[0]#0"c";[Red]0"c"

is invalid?


--
LoganStallworth
------------------------------------------------------------------------
LoganStallworth's Profile: http://www.excelforum.com/member.php...o&userid=27561
View this thread: http://www.excelforum.com/showthread...hreadid=471534



All times are GMT +1. The time now is 10:01 AM.

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