#1   Report Post  
Paul
 
Posts: n/a
Default Leading zeros

When entering an 'IF' formula to locate information on another spreadsheet
the formula truncates the leading zeros in my argument. The information I
want is tied to a reference with leading zeros i.e. 00123 and so on. How can
i set the formula to accept the leading zeros to locate the correct
information?
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Maybe you can use "00123" in your formula. =if(a1="00123", ...

Or if 123 is in a cell, =if(text(a1,"00000")....

But if that reference is just 123 and formatted to show leading 0's, you'll
still want to use the numeric value 123--not the text "00123".



Paul wrote:

When entering an 'IF' formula to locate information on another spreadsheet
the formula truncates the leading zeros in my argument. The information I
want is tied to a reference with leading zeros i.e. 00123 and so on. How can
i set the formula to accept the leading zeros to locate the correct
information?


--

Dave Peterson
  #3   Report Post  
Paul
 
Posts: n/a
Default

My formula is as shown - =IF('[production sheet
template.xls]1'!$Q$14=212,'[production sheet template.xls]1'!$S$14,0) - My
problem is that I need to use 00212 instead of 212 in the formula but when i
use 00212 excel truncates it to the above and the correct value is then not
resolved in the cell. I am ok with formatting the cell itself to show the
correct value, its the formula itself that truncates and then does not use
the leading zeros. Can you help please?

"Dave Peterson" wrote:

Maybe you can use "00123" in your formula. =if(a1="00123", ...

Or if 123 is in a cell, =if(text(a1,"00000")....

But if that reference is just 123 and formatted to show leading 0's, you'll
still want to use the numeric value 123--not the text "00123".



Paul wrote:

When entering an 'IF' formula to locate information on another spreadsheet
the formula truncates the leading zeros in my argument. The information I
want is tied to a reference with leading zeros i.e. 00123 and so on. How can
i set the formula to accept the leading zeros to locate the correct
information?


--

Dave Peterson

  #4   Report Post  
Jonas
 
Posts: n/a
Default

I run into this sort of an issue at work from time to time. What you
basically have to do is tell your formula to ignore the first couple of zeros
when checking the value of your cell. You can do this by using the MID
function. This function checks only a portion of the cell for a value
instead of looking at the whole.

For example, the syntax for the function could look like this: MID(A1,3,10)
where A1 is your cell reference, 3 is how many characters from the left to
start looking, and 10 is the maximum number of characters to look for,
although this number can be any length you choose.

How this translates to your problem is this: Let's say your value is in
cell A1 and it equals '00212', the function will examine this value starting
at the third character and every character afterward until it reaches 10
characters. So the value will end up being '212' not '00212'.

Try entering this forumula: IF('[production sheet
template.xls]1'!mid($Q$14,3,10)="212",'[production sheet
template.xls]1'!$S$14,0)

That should do the trick. Just make sure that you put the 212 in quotation
marks as shown above. Otherwise, I don't think it will work.


"Paul" wrote:

My formula is as shown - =IF('[production sheet
template.xls]1'!$Q$14=212,'[production sheet template.xls]1'!$S$14,0) - My
problem is that I need to use 00212 instead of 212 in the formula but when i
use 00212 excel truncates it to the above and the correct value is then not
resolved in the cell. I am ok with formatting the cell itself to show the
correct value, its the formula itself that truncates and then does not use
the leading zeros. Can you help please?

"Dave Peterson" wrote:

Maybe you can use "00123" in your formula. =if(a1="00123", ...

Or if 123 is in a cell, =if(text(a1,"00000")....

But if that reference is just 123 and formatted to show leading 0's, you'll
still want to use the numeric value 123--not the text "00123".



Paul wrote:

When entering an 'IF' formula to locate information on another spreadsheet
the formula truncates the leading zeros in my argument. The information I
want is tied to a reference with leading zeros i.e. 00123 and so on. How can
i set the formula to accept the leading zeros to locate the correct
information?


--

Dave Peterson

  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

You could try:

=IF('[production sheet template.xls]1'!$Q$14="00212",'[produc......

But this means that Q14 holds a text string--not just 212 with a custom format
of 00000.



Paul wrote:

My formula is as shown - =IF('[production sheet
template.xls]1'!$Q$14=212,'[production sheet template.xls]1'!$S$14,0) - My
problem is that I need to use 00212 instead of 212 in the formula but when i
use 00212 excel truncates it to the above and the correct value is then not
resolved in the cell. I am ok with formatting the cell itself to show the
correct value, its the formula itself that truncates and then does not use
the leading zeros. Can you help please?

"Dave Peterson" wrote:

Maybe you can use "00123" in your formula. =if(a1="00123", ...

Or if 123 is in a cell, =if(text(a1,"00000")....

But if that reference is just 123 and formatted to show leading 0's, you'll
still want to use the numeric value 123--not the text "00123".



Paul wrote:

When entering an 'IF' formula to locate information on another spreadsheet
the formula truncates the leading zeros in my argument. The information I
want is tied to a reference with leading zeros i.e. 00123 and so on. How can
i set the formula to accept the leading zeros to locate the correct
information?


--

Dave Peterson


--

Dave Peterson
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
Format a cell to keep leading zeros. Shadyhosta New Users to Excel 5 July 27th 05 05:37 PM
save text field w/ leading zeros in .csv format & not lose zeros? Ques Excel Discussion (Misc queries) 1 May 4th 05 07:21 PM
zero supress leading zeros when chg format from text to number HeatherO Excel Worksheet Functions 4 February 28th 05 12:11 AM
Leading zeros JC Excel Discussion (Misc queries) 9 February 1st 05 03:33 PM
Displaying leading zeros in an Excel spreadsheet marianthelibrarian Excel Discussion (Misc queries) 1 January 25th 05 03:08 PM


All times are GMT +1. The time now is 12:01 PM.

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

About Us

"It's about Microsoft Excel"