Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Frank Marousek
 
Posts: n/a
Default Using formatted cells in formulas

I have been provided a worksheet with a list of 5-digit part numbers that
the creator of the worksheet formatted as zip code to preserve leading
zeros. I need to use these cells in a formula which uses the "&" operator to
tack on a suffix. For example:

Original part number cell A1 = 2345 (with zip code formatting displays as
02345)

I need cell A2 to be 02345XX, so I'm using the following formula: A1&"XX".

Problem is, when I do this, Excel drops the leading zero and displays
2345XX. Is there a way to have Excel use the formatted display string for
cell A1 instead of the underlying numeric value?


  #2   Report Post  
Earl Kiosterud
 
Posts: n/a
Default

Frank,

Use something like

=TEXT(A1, "00000") & "XX"

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Frank Marousek" wrote in message
...
I have been provided a worksheet with a list of 5-digit part numbers that
the creator of the worksheet formatted as zip code to preserve leading
zeros. I need to use these cells in a formula which uses the "&" operator
to
tack on a suffix. For example:

Original part number cell A1 = 2345 (with zip code formatting displays as
02345)

I need cell A2 to be 02345XX, so I'm using the following formula: A1&"XX".

Problem is, when I do this, Excel drops the leading zero and displays
2345XX. Is there a way to have Excel use the formatted display string for
cell A1 instead of the underlying numeric value?




  #3   Report Post  
swatsp0p
 
Posts: n/a
Default


Excel is simply displaying the zeros, which are not really there (try
=Len(A1) to see). Using that principle, we can test the length of A1
and add zeros as needed:

in cell A2:
=IF(LEN(A1)=4,"0"&A1&"XX",IF(LEN(A1)=3,"00"&A1&"XX ",A1&"XX"))

I am assuming no part code number is fewer than three 'true' digits
(00123)

HTH


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=377081

  #4   Report Post  
Frank Marousek
 
Posts: n/a
Default

Two good suggestions... thanks!


--

"swatsp0p" wrote in
message ...

Excel is simply displaying the zeros, which are not really there (try
=Len(A1) to see). Using that principle, we can test the length of A1
and add zeros as needed:

in cell A2:
=IF(LEN(A1)=4,"0"&A1&"XX",IF(LEN(A1)=3,"00"&A1&"XX ",A1&"XX"))

I am assuming no part code number is fewer than three 'true' digits
(00123)



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
refreshing formulas in cells He4Giv Excel Discussion (Misc queries) 10 November 28th 05 05:01 PM
Copy range of cells omitting formulas that result in " " Plot only cells with values in column Excel Discussion (Misc queries) 1 May 24th 05 08:52 PM
loan calculator cells, P&I formulas do not copy to second cloumn Mr. C Excel Worksheet Functions 4 March 5th 05 03:45 PM
Copy & Paste Visible Cells with Formulas Ricky Excel Worksheet Functions 5 January 27th 05 05:37 PM
how to copy formulas to other cells in excell eugene Setting up and Configuration of Excel 1 January 16th 05 11:25 PM


All times are GMT +1. The time now is 06:35 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"