Thursday, December 15, 2011

IF Statement and adding to a Date?

Can someone please help me with this?





I have 5 possible options here is what I'm looking at, I'm not even sure I should use an IF Statement it just seems like it might work.





IF D4=CP then D4+270


IF D4=VR then D4+540


IF D4=CT then D4+540


IF D4=FL then D4+420


IF D4=GP then D4+540





I appreciate any help.|||IF D4=CP


then D4+270


ELSE IF D4=VR


then D4+540


ELSE IF D4=CT


then D4+540


ELSE IF D4=FL


then D4+420


ELSE IF D4=GP


then D4+540


ELSE


then do default





Just added ELSE IF and default ELSE.





Adding ELSE IF means that system will not check any further once one of the IF condition is satisfied. Added ELSE means that your code will take care of all criteria. Just a good programming practice.





Otherwise your logic looks like it will work.











After Edits:


I don't believe in giving out ready work.


But here is what your IF statement should look like. Just replace the values.





=IF(H10=I10,H10+5,


IF(H10=I11,H10+6,


IF(H10=I12,H10+7,H10)))|||Thank you Garbo7441 - I used your formula and received the best result. I am unable to change my Best Answer to yours though.

Report Abuse


|||Edit:





You can also use this formula:





=IF(D4="CP",D5 + 270, IF(OR(D4="VR", D4="CT",D4="GP"),D5+540,IF(D4 = "FL",D5+420,"")))














I don't believe you can have D4 equal both "CP" AND "CP+270" simultaneously.





How would one add '270' to "CP", for example?





Do you mean a different cell reference in your example?

No comments:

Post a Comment