|
#1
|
||||
|
||||
Jamal, let me try. One thing I see wrong in your attachment is the way you're attempting to do "and" conditions:
Code:
=IF((A2>0&B2>0),A2+B2, 0) Code:
(A2 > (0 & B2)) > 0 To do an AND condition, change your formula to do this: Code:
=IF(AND(A2>0,B2>0),A2+B2,0) 1) You tried three time to explain to Pecoflyer what you want to accomplish, and although the explanations look clear enough to me, I do notice that you said it differently each time. The first time, on 07-28, you said: A>0, B>0 => A+B A>0, B<0 => A-B A<0, B>0 => 2A A<0, B<0 => 3B-9 The next day you changed what happened when A is negative: A<0, B>0 => =2A-B A<0, B<0 => 3B-A The third time, 07-30, you just gave constants: A>0, B>0 => 10 A>0, B<0 => 20 A<0, B>0 => 30 A<0, B<0 => 40 I think I know why you did that: You already know how to do the arithmetic calculation, but you wanted to ask only about the IF formula. But if there's another reason, what is it? 2) If you're not sure how to combine many IF statements together, here's one sample. It uses your first set of calculations, and if any of the values in A or B is equal to 0 (rather than greater or less) then it displays a blank value: Code:
=IF(AND($A2>0,$B2>0),$A2+$B2,IF(AND($A2>0,$B2<0),$A2-$B2,IF(AND($A2<0,$B2>0),$A2*2,IF(AND($A2<0,$B2<0),3*$B2-9,"")))) Code:
=IF($A2>0,IF($B2>0,$A2+$B2,$A2-$B2),IF($B2>0,$A2*2,$B2*3-9)) Code:
=(1-SIGN(A2))+(1-SIGN(B2))/2+1 Code:
=CHOOSE((1-SIGN(A2))+(1-SIGN(B2))/2+1,A2+B2,A2-B2,A2*2,B2*3-9) Feel free to ask more questions, but I hope this helps out some. |
#2
|
|||
|
|||
Quote:
Correct. You got my point. All what I wanted to know is how to write an If statement for the cases below if A3>0 and B3>0 then C3=10 If A3>0 and B3<0 then C3=20 If A3<0 and B3>0 then C3=30 If A3<0 and B3<0 then C3=40 The equation you have provided works fine (attached) =IF(AND(A3>0,B3>0),10,IF(AND(A3>0,B3<0),20,IF(AND( A3<0,B3>0),30,IF(AND(A3<0,B3<0),40,"")))) Best Jamal
__________________
Jamal NUMAN, Jamal432@gmail.com, P.O.BoX: 731, Ramallah, West Bank. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Please tell me it doesn't take 7 statements to turn table borders off | Jennifer Murphy | Word VBA | 5 | 07-25-2012 03:12 PM |
showing results of If statements in a mail merge | m&co | Mail Merge | 3 | 01-06-2012 07:27 PM |
Multiple Input, Multiple Digital Signatures | Jeff | Word | 0 | 01-04-2012 09:03 AM |
Multiple task lists and multiple calendars | kballing | Outlook | 0 | 01-18-2011 10:23 AM |
IF statements that shifts to right. | kent | Excel | 0 | 01-19-2006 02:23 PM |