Adding up Column in a Table if the cell has a value

Front

Board Regular
Joined
Oct 26, 2021
Messages
54
Office Version
  1. 2016
Platform
  1. Windows
Hi Everyone, I am having a hard time getting this weighted average formula to work with my table. Been working on this for about 5 hours and cannot believe I cannot get this to work...

I am trying to say if the cell has no value then skip that row, but if it does have a value then get the value from another cell in that row and divide it by the total of all those cells.

So this formula works perfectly if there are no rows to skip.

=SUMPRODUCT(Table13425[ROC %]*(Table13425[Reserve Requirement]/SUM(Table13425[Reserve Requirement])))

But I need it to skip rows that have empty cells in column Table1342[Close Price Per Contract / Share]

So I tried this, seems like it should have worked based on what I read. But did not.

=SUMPRODUCT(--(Table13425[Close Price Per Contract / Share]>0),Table13425[ROC %]*(Table13425[Reserve Requirement]/SUM(Table13425[Reserve Requirement])))

I also tried this and it did not.

=SUMPRODUCT(IF(Table13425[Close Price Per Contract / Share]>0,(Table13425[ROC %]*(Table13425[Reserve Requirement])/SUM(Table13425[Reserve Requirement]))))

The both just return #VALUE!.

Can anyone shed some light on this?
 
Last edited:
because it will pull in value from the Reserve Requirement cell when I don't want it to.
No, it will not. That row will have a zero value when the formula evaluates!

As I said earlier,
The only part that may not be 'skipped' correctly (depending on requirement) is the last part, SUM(Table13425[Reserve Requirement]) which will still include all rows.
I specifically included the part with the SUM() function as it is only that part which is affected, not the rest of the formula. If the same rows need to be omitted there as well then it can be done easily by using sumif instead of sum with a ">0" criteria on the close price column.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Thanks again for your help, I added the SUMIF to the Reserve requirement row and it worked. At least I think, will do a bit more testing.
 
Last edited:
Upvote 0
I added the SUMIF to the Reserve requirement row and it worked.
To the row or to the formula?

=SUMPRODUCT(IF(Table13425[Close Price Per Contract / Share]>0,(Table13425[ROC %]*(Table13425[Reserve Requirement])/SUMIF(Table13425[Close Price Per Contract / Share],">0",Table13425[Reserve Requirement]))))

This should also give the same result without array confirmation, note that I've used a different configuration and that there are no mathematical operations (+ - * / etc) in the sumproduct function other than the logical test coercion.

=SUMPRODUCT(--(Table13425[Close Price Per Contract / Share]>0),Table13425[ROC %],Table13425[Reserve Requirement])/SUMIF(Table13425[Close Price Per Contract / Share],">0",Table13425[Reserve Requirement])
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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