#1   Report Post  
Posted to microsoft.public.excel.misc
Ian
 
Posts: n/a
Default IIf and value-errors

Not sure why your original formula doesn't work (not sure why you're using
FIND) but this should do what you want.

=IF(LEFT(B3;2)="07";"M";IF(LEFT(B3;1)="0";"F";"U") )

--
Ian
--
"david" wrote in message
news:1ha8fml.11oh8s8ndnm8lN%messages.from.usenetRE ...
I have a column with numbers A (as text, I want to keep initial zeros):

05...
07...
08...
12...
41...

In another column B I want a letter that depends on the initial numbers
in the A-column. If the initial number is 0 I want an "F" in B, if it is
07 I want "M" in B and in all other cases I want an "U" in B:

F 05...
M 07...
F 08...
U 12...
U 41...

I created a formula for this purpose:

=IF(
FIND("07";LEFT(B3;2);1);
"M";
IF(FIND("0";LEFT(B3;1);1);"F";"U"))

The problem is that it only works for the M-cases. All other cases
return a value-error. However, if I break out line 4 in the formula it
works as expected. I am puzzled.

Any ideas why it doesn't work and how I can fix it?

This is in MacExcel but that shouldn't matter, should it?

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?



  #2   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default IIf and value-errors

Hi David,
You're puzzled? What about me?
My Excel rejected the use of ; where there should have been ,
I came up with the same formula as Ian, but with commas, not
semicolons.
What's going on there?
Using FIND didn't work because if the text is not found the #VALUE
error is returned rather than FALSE and this stuffs up the whole
formula.
Ian's formula works because it traps the 07's first so they're then not
included in the testing for the 0's
Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default IIf and value-errors

The list separator is defined by a windows setting--under regional settings.
Most people in the USA use a comma for the list separator. Many in other parts
of the world use a semicolon.

And if you did want to use =find() or =search() (not a particularly good fit in
this example), you could check to see if it actually found something:

=if(isnumber(find("ken",a1)),"Yep","nope")

=find() is case sensitive
=search() is not.

Ken Johnson wrote:

Hi David,
You're puzzled? What about me?
My Excel rejected the use of ; where there should have been ,
I came up with the same formula as Ian, but with commas, not
semicolons.
What's going on there?
Using FIND didn't work because if the text is not found the #VALUE
error is returned rather than FALSE and this stuffs up the whole
formula.
Ian's formula works because it traps the 07's first so they're then not
included in the testing for the 0's
Ken Johnson


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default IIf and value-errors

Thanks Dave
Ken Johnson

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



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

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"