View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Lars-Åke Aspelin[_2_] Lars-Åke Aspelin[_2_] is offline
external usenet poster
 
Posts: 913
Default Help with Formula

On Fri, 17 Jul 2009 21:18:14 GMT, Lars-Åke Aspelin
wrote:

On Fri, 17 Jul 2009 13:52:01 -0700, chefmike
wrote:

Hi Everyone,

I have a formula and not sure why it is not working properly, was hopeing
someone could help me with it?

the formula is:
=IF(OR(M7=53,M7<=7),0,IF(OR(M7=8,M7<=22),15,IF (OR(M7=23,M7<=37),30,IF(OR(M7=38,M7<=52),45,FALS E))))

The problem is if M7 is say 57 it works fine, if M7 is 7 it works fine, if
M7 is 9 it works fine, if M7 is 23 it doesn't work it gives an answer of 15
(should be 30), any number above 23 to 53 it gives an answer of 15. What am
I doing wrong in this formula? Am I using the right formula and if so how
come it is not reading the entire formula to produce the right answer?

I have tried the Evaluate Formula Auditing Box and it shows me that when it
reaches M7<=7, it is a True statement.

Thanks in advance for all help

mike



Is this what you want?

=IF(OR(M7=53,M7<=7),0,IF(AND(M7=8,M7<=22),15,IF (AND(M7=23,M7<=37),30,IF(AND(M7=38,M7<=52),45,FA LSE))))

Hope this helps / Lars-Åke


And this can be written more compact, like

=IF(M7<8,0,IF(M7<23,15,IF(M7<38,30,IF(M7<53,45,0)) ))

/ Lars-Åke