If Then and Formula assistance

Copper Contributor

Greetings,

I am having trouble scripting the correct command and am hoping that there is a way to do it and that some one can help me.  I am using PC with Office 365.  

 

As of now, N4 equals L4 - M4.  I would like to maintain that formula if the value in K4 is positive.  If the value in K4 is negative, then I would like the formula used to be N4 equals L4.

 

Thank you for your time and any assistance you may provide!

 

 

 

4 Replies
Seems pretty straight forward to me, if I understand your question correctly of course.

use the conditional IF operator to apply the result
into N4 you would use:

=IF(K4>0,L4-M4,L4)

since your condition of "is positive" is binary (yes or no) you only need one logical test because the other condition is therefore implied

*this only holds true if there are only positive or negative numbers, 0 is neither so I don't know if you need to handle that case

@TRethan009 

As variant that could be

=L4-M4*(K4>0)

And as a comment I'd remove wrapping by IFERROR() every formula in the sheet, only where necessary.  In current variant that's mainly since you use =IFERROR(D3/F3,"") returning empty string in case of error. Thus we have column with combination of different value types in it, numbers and texts. Thus we have to handle that with all other formulas to check do we have with text of with number.

I'd return number in case of error (zero) as =IFERROR(D3/F3,0), thus we may simplify all next formulas.

Not to show zero we may hide it by format, e.g. just add another semicolon at the end of existing format string in column N

"$"#,##0.00_);[Red]("$"#,##0.00);

More exactly, it shall be blank between second and third parts of the format string

Exactly what I was looking for, didn't know how to write it. Thank you so much for your help I really appreciate it!
Thank you for taking the time to reply and offering a solution, I appreciate the info, thank you!