#1   Report Post  
Posted to microsoft.public.excel.misc
mary
 
Posts: n/a
Default Leading zeros

How do I retain the leading zeros in an if statement eg if b3=b2 then b4+1
where b4 = 0001. The next number generated should be 0002 not 2.

Thanks
Mary
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre
 
Posts: n/a
Default Leading zeros

If you set the number format for those cells to be 0000, they'll show the
leading zeros, but they won't actually be part of the value. Meaning that
the number 2 will display as 0002.

They you could use a variation of this formula:
=IF(B2=B3,B4+1,B4)

Alternatively, you could try working with this:
=IF(B2=B3,TEXT(--(B4)+1,"0000"),B4)

Which will actually create "numeric text" but treat it like a number. The
value will be the string 0002, not the number 2.

Something you can work with?

***********
Regards,
Ron

XL2002, WinXP-Pro


"mary" wrote:

How do I retain the leading zeros in an if statement eg if b3=b2 then b4+1
where b4 = 0001. The next number generated should be 0002 not 2.

Thanks
Mary

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
Leading Zeros Karen Excel Discussion (Misc queries) 3 January 10th 06 09:50 PM
Spliting a number with leading zeros haitch2 Excel Discussion (Misc queries) 7 September 30th 05 12:09 AM
Format a cell to keep leading zeros. Shadyhosta New Users to Excel 5 July 27th 05 04:37 PM
How do I force leading zeros in an Excel cell? EricKei Excel Discussion (Misc queries) 2 June 15th 05 08:28 PM
Leading zeros Paul Excel Discussion (Misc queries) 4 June 12th 05 04:04 AM


All times are GMT +1. The time now is 02:05 AM.

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

About Us

"It's about Microsoft Excel"