IF function.

smarler

New Member
Joined
May 22, 2018
Messages
3
I am having difficulty getting an IF function to work.

=IF(I3>0,"I3", I3+P2, "0")

I want this to happen:

If cell I3 is greater than ZERO, then show what is in the cell, if not, show ZERO AND then in column P3 have the sum of I3 and P2

Can anyone help please?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Welcome to the Board!

A few things:
- In formulas, anything enclosed in double-quotes is treated as literal text. So you do not want any cell references enclosed in double-quotes.
- Excel formulas can only return values to the cell that they are located in. They cannot return data to other cells.
- The Excel IF function only has 3 arguments, not 4 (see: https://www.techonthenet.com/excel/formulas/if.php).

So, your first formula should be:
Code:
=IF(I3>0,I3,0)
or you could simply use:
Code:
=MAX(I3,0)

Regarding what is in cell P3, you are saying if I3 is zero, then show the sum of I3 and P2. But if I3 is zero, then there is no point in including it in the sum. It would just be P2.
So, if you want to show the value of P2 in cell P3 if I3 is zero, then your formula in cell P3 might look something like:
Code:
=IF(I3=0,P2,"")
 
Last edited:
Upvote 0
Welcome to the Board!

A few things:
- In formulas, anything enclosed in double-quotes is treated as literal text. So you do not want any cell references enclosed in double-quotes.
- Excel formulas can only return values to the cell that they are located in. They cannot return data to other cells.
- The Excel IF function only has 3 arguments, not 4 (see: https://www.techonthenet.com/excel/formulas/if.php).

So, your first formula should be:
Code:
=IF(I3>0,I3,0)
or you could simply use:
Code:
=MAX(I3,0)

Regarding what is in cell P3, you are saying if I3 is zero, then show the sum of I3 and P2. But if I3 is zero, then there is no point in including it in the sum. It would just be P2.
So, if you want to show the value of P2 in cell P3 if I3 is zero, then your formula in cell P3 might look something like:
Code:
=IF(I3=0,P2,"")


Thank you.
That makes sense, so I need to do this: I want a figure in P3 - so that If cell I3 is equal to ZERO, show nothing, if not, then in column P3 have the sum of I3 and P2 (like a running total).

 
Upvote 0
I want a figure in P3 - so that If cell I3 is equal to ZERO, show nothing, if not, then in column P3 have the sum of I3 and P2 (like a running total).
OK, sounds like you initially stated that backwards.
If cell I3 is greater than ZERO, then show what is in the cell, if not, show ZERO AND then in column P3 have the sum of I3 and P2

You should be able to apply the same kind of logic, just in reverse.
Code:
=IF(I3=0,"",I3+P2)
 
Upvote 0
Thank you.
That makes sense, so I need to do this: I want a figure in P3 - so that If cell I3 is equal to ZERO, show nothing, if not, then in column P3 have the sum of I3 and P2 (like a running total).



THANKS, worked it out with that, THANK YOU.
 
Upvote 0
You are welcome.

Hopefully, you see the logic and have a better understanding of how the IF function works.
If you are still a little unclear on that, look at the explanation and examples in the link I provided above.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,205
Members
448,554
Latest member
Gleisner2

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