If/Then Simple but stuck

deltasd

New Member
Joined
Jan 4, 2022
Messages
2
Office Version
  1. 365
I am trying to write a formula that lists when we owe and when we are due. One cell lists the total amount of funds distributed, another lists amount spent. I want one cell that reads if one cell is greater than the other, zero is due and if less than, the difference in the two numbers. The other cell is to read the opposite; if it is less than, the difference is owed, if greater, it should read zero. I've tried variations of =IF(C41>C42,0)*IF(C41<C42,"SUM"). Can you point me in the right direction?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Welcome to the Board!

I don't know if you question is entirely clear, because you mention "if one number is greater/less than the other", but don't mention which one.
But I think you can use the MIN/MAX functions to do what you want, i.e.
Excel Formula:
=MIN(C41-C42,0)
will return C41-C42, but will return 0 if that value is negative.

And
Excel Formula:
=MAX(C41-C42,0)
will return C41-C42, but will return 0 if that value is positve.
 
Upvote 0
One cell lists the total amount of funds distributed, another lists amount spent.
so is that cell C41 & C42
I want one cell that reads if one cell is greater than the other,
C41>C42
so if C41 is greater than C42 - Zero is due

=IF( C41>C42, 0,

if it is less than, the difference is owed,

So if its not greater than , it MUST be equal or Less

=IF( C41>C42, 0,
the difference is owed,

so C41 is greater then C41 - C42 is the difference

=IF( C41>C42, 0, C41-C42)

what if its equal
 
Upvote 0
Solution
so is that cell C41 & C42

C41>C42
so if C41 is greater than C42 - Zero is due

=IF( C41>C42, 0,



So if its not greater than , it MUST be equal or Less

=IF( C41>C42, 0,


so C41 is greater then C41 - C42 is the difference

=IF( C41>C42, 0, C41-C42)

what if its equal
I am so sorry my explanation wasn't very clear. I should have stated C41 totals actual expenses and C42 totals funds advanced. C43 is amount due them and C44 is amount due us. If equal, then should be zero. Your formula worked perfectly, even if equal it just zeroed them both, which is accurate. Thank you very kindly!
 
Upvote 0
Note that the first formula I posted:
Excel Formula:
=MIN(C41-C42,0)
is equivalent to:
Excel Formula:
=IF(C41>C42,0,C41-C42)
and simpler/shorter.

The MIN and MAX functions are very useful functions.
I suggest you read up in them.
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top