C1 = A1-A2 if A1 is less than A2 - in Excel

+1 vote
asked by about Microsoft Office Excel Viewer
edited by

How would I write this in Excel formula?

C1 = A1-A2 if A1 is less than A2.

2 Answers

+2 votes
No avatar answered by (2.4k points)

The formula for the C1 cell should look like this:

=if(A1<A2, A1-A2, 0)

The third value in the 'if' statement (in this case, a zero) is the value that is returned if the condition is not met. In general terms, the syntax is this: =if(condition, value if true, value if false).

0 votes
answered (8.1k points)

Here the value in C1 is as follws:

=IF(A1<A2, A1-A2, 0)

The third value in the 'IF' statement (here 0) is the value that is returned if the condition is not met. Thus the Syntax would be: "=IF(Condition, Value if true, Value if false)".

You can get these formulas & their synatx, if you type "SHIFT+F3", & then the relevant formula is choosen.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...