IF statement?

Nitsalet

New Member
Joined
Feb 22, 2020
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
I am sure this is a simple IF statement but it has me stumped.
In Cell J5 I need a formula that will calculate the following:
If the value of Cell E5 is 0, add F5 through H5 and multiply by 1, otherwise add F5 through H5 and multiply by cell E5
I will need to copy this cell down the column so that it applies to the next row.
Any help would be appreciated!
 

Attachments

  • 1582408997737.png
    1582408997737.png
    581 bytes · Views: 3

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Map1
EFGHIJ
5539480
Blad1
Cell Formulas
RangeFormula
J5J5=IF(E5=0, SUM(F5:H5), SUM(F5:H5)*E5)
 
Upvote 0
Assuming that E5 is never negative, another way would be

=SUM(F5:H5)*MAX(E5,1)
 
Upvote 0
Thanks for your response. However, I need the formula to multiply by 1 if the value in E5 is 0. The formula is going in the Total Qty column in the image below and calculates the total number of shirts in a carton, although sometimes a carton is shared (as in the second row of data).
1582410156326.png
 
Upvote 0
.... and fwiw, multiplying by 1 gives the same result so can be omitted.
 
Upvote 0
Both formulas suggestions work (see below) my formula in I5:I7, GWteB's formula in J5:J7
Book12345.xlsm
EFGHIJ
511051515
60101010
8210206060
Sheet7
Cell Formulas
RangeFormula
I8,I5:I6I5=SUMPRODUCT(F5:H5*MAX(E5,1))
J8,J5:J6J5=IF(E5=0, SUM(F5:H5), SUM(F5:H5)*E5)

edit:- actually a variation of my suggestion, I forgot which one I had posted.
 
Upvote 0
you're welcome and thanks for letting us know.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,397
Members
448,957
Latest member
Hat4Life

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