ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   If/then formulas (https://www.excelbanter.com/excel-worksheet-functions/187670-if-then-formulas.html)

akerney

If/then formulas
 
I have a worksheet that has a formula for one of the cells (=SUM(J5*F5)-G5).
Now I need to put an if/then formula into that particular formula. When I use
the formula above, the answers sometimes come out negative (which is normal)
but I need it to be programmed where, if the answer comes out negative, then
it should automatically be adjusted to $0. How do I add and if/then formula
to a formula already given??

FSt1

If/then formulas
 
hi
=IF(SUM(J5*F5)-G5<0,0,SUM(J5*F5)-G5)


Regards
FSt1

"akerney" wrote:

I have a worksheet that has a formula for one of the cells (=SUM(J5*F5)-G5).
Now I need to put an if/then formula into that particular formula. When I use
the formula above, the answers sometimes come out negative (which is normal)
but I need it to be programmed where, if the answer comes out negative, then
it should automatically be adjusted to $0. How do I add and if/then formula
to a formula already given??


Niek Otten

If/then formulas
 
First, you don't need the SUM part;
This will do:
=(J5*F5)-G5

New formula:
=MAX((J5*F5)-G5),0)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"akerney" wrote in message ...
|I have a worksheet that has a formula for one of the cells (=SUM(J5*F5)-G5).
| Now I need to put an if/then formula into that particular formula. When I use
| the formula above, the answers sometimes come out negative (which is normal)
| but I need it to be programmed where, if the answer comes out negative, then
| it should automatically be adjusted to $0. How do I add and if/then formula
| to a formula already given??



Sandy Mann

If/then formulas
 
Try:

=MAX(J5*F5-G5,0)
Note that the neither the SUM() not the parenthesis around J5*F5 are
required because in XL multiplication takes precedence over subtraction.


--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"akerney" wrote in message
...
I have a worksheet that has a formula for one of the cells
(=SUM(J5*F5)-G5).
Now I need to put an if/then formula into that particular formula. When I
use
the formula above, the answers sometimes come out negative (which is
normal)
but I need it to be programmed where, if the answer comes out negative,
then
it should automatically be adjusted to $0. How do I add and if/then
formula
to a formula already given??





All times are GMT +1. The time now is 06:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com