Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Problem with nesting an OR in a formula

Hi

I have a formula which is starting to get beyond my knowledge, I don't know
where to put the OR!

=IF(LEFT(C10,1)="F","AC"&MID(C10,2,7),"AC"&MID(C10 ,1,7))

My problem is I would like to test if the 1st character is an F or 0 then
drop it, but I still need an 8 digit account number. I can see from the
help it is possible but whereever I put it I just get an error in the
formula

Can anyone help?

Thanks

Wendy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Problem with nesting an OR in a formula

Not sure exactly what you are after. You can check if the first
character is an F or 0 and drop it with:

=IF(or(LEFT(C10,1)="F",LEFT(C10,1)="0"),"AC"&MID(C 10,2,7),"AC"&MID(C10,1
,7))

However, this only gives you an account number that starts AC and then
has up to 7 digits. Did you want 8 digits with 0's at the beginning (eg
so 1234567 becomes 01234567)? If so, try:

="AC"&TEXT(IF(OR(LEFT(C10,1)="F",LEFT(C10,1)="0"), MID(C10,2,7),MID(C10,1
,7)),"00000000")

Andy

*** Sent via Developersdex http://www.developersdex.com ***
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Problem with nesting an OR in a formula

Wendy, solve for a true or false as your first step and "build out" as you
develop your formula; that is, whether the first character for the cell in
question is either an F or a 0, solve that first:

=OR(Left(C10,1)="F",Left(C10,1)=0) ------- this will return a TRUE or a
FALSE

then, build out with the formula by adding your IF in front of the OR...

If(OR(Left(C10,1)="F",Left(C10,1)=0),"AC"&MID(C10, 2,7),"AC"$MID(C10,1,7))

If the "OR" portion of the formula returns a "true," then it will execute
the first bit of code ("AC"&MID(C10,2,7)); if it is false, it will activate
the second piece of code ("AC"$MID(C10,1,7)).

Cheers! Brad



"Wendy" wrote in message
...
Hi

I have a formula which is starting to get beyond my knowledge, I don't
know
where to put the OR!

=IF(LEFT(C10,1)="F","AC"&MID(C10,2,7),"AC"&MID(C10 ,1,7))

My problem is I would like to test if the 1st character is an F or 0 then
drop it, but I still need an 8 digit account number. I can see from the
help it is possible but whereever I put it I just get an error in the
formula

Can anyone help?

Thanks

Wendy




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
Nesting Problem Ed Davis Excel Discussion (Misc queries) 1 September 2nd 08 02:21 AM
HLP! Nesting Problem?? dee Excel Worksheet Functions 4 June 15th 07 02:15 AM
Nesting Problem vgreen Excel Worksheet Functions 1 August 24th 05 03:44 PM
Nesting problem? CBrausa[_2_] Excel Programming 3 June 27th 05 06:00 PM
nesting problem a Excel Programming 2 February 4th 04 02:29 PM


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