Formula in one column to calculate the sumproduct of cells between two blank cells

secrestj

New Member
Joined
Feb 18, 2005
Messages
15
Office Version
  1. 365
Platform
  1. Windows

I previously posted a similar question; however, I did not provide all the details and intended to adapt any response to my need. I was UNSUCESSFUL, being 'to smart by half'.

The following table represents real estate type and their statuses, with their quantity and occupancy. The 'Total' rows (6,10,15,20 - in the sample below) represent the weighted average in the percentage column.

I want to create a formula in column E that allows me to copy/paste new data in columns A, B, C, D and columns E will adjust to the new quantity of the data sets (with the format and columns A, B, C, D being the same). For example, sometimes the quantity of multi-family data set has 2, 4, 5 rows rather than 3 rows in this example below. The goes with 'office' and sometimes there is 'retail (or other real estate types).
As such, I am trying for a formula that is already in Column E (adjusting to the change in Column A-D data) and I can drag the formula down if there are more rows in the data set. Also, I am validating the weighted average formula is calculating correctly and not relying on the data totals in columns C and D that are provided to me.

My current formula (before considering your assistance) is the following, but it is not dynamic to grow/contract with the quantity (row) changes of MF, Office, etc. and I go into the formula and add/reduce rows in the formulas on each of the total rows in column E.
E6=IF(ABS(SUMPRODUCT(C3:C5,D3:D5)/C6-D6)>0.01,"FAIL","VALID")

Then, I started with a formula that only displays calculations in Column E based on an if statement, but cannot figure out the how to make a formula that runs the calculation based on the rows between the two 'blank' cells of column B, which is the only consistent pattern I can think of to base the dynamic calculations and make it drag-able down column E if there is more data provided.

E6=IF(OR(AND(ISTEXT($A6),$B6=""),AND($A6="",$B6="")),"", ???????????????????

A​
B​
C​
D​
E​
1​
TypeStatusAmount%Valid/Fail
2Commercial RE
3​
MF-1Good2095.0%
4​
MF-2Good4088.0%
5​
MF-3Good3092.0%
6​
Total Good MF9090.9%VALID
7​
MF-1Bad2082.0%
8​
MF-2Bad1084.0%
9​
MF-3Bad1073.0%
10​
Total Bad MF4080.3%VALID
11​
Office-1Good5094.0%
12​
Office-2Good1094.0%
13​
Office-3Good3091.0%
14​
Office-4Good4092.0%
15​
Total Good Office13092.7%VALID
16​
Office-1Bad1071.0%
17​
Office-2Bad1083.0%
18Office-3Bad2078.0%
19Office-4Bad5077.0%
20Total Bad Office9077.2%VALID

If you can help figure this formula out, I would greatly appreciate it. This forum has always been an amazing resource. Thank you.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi secrestj,

First of all your answer should be fail since your division is not interpreted like it should. What you do is SUMPROD by C6 then minus D6, instead of SUMPROD divided by the difference between C6 and D6.

Here's what I would do (formula for cell E2 then drag down):
Excel Formula:
=IF(B2="",LET(nextEmptyRow,CHOOSEROWS(LAMBDA(c,FILTER(c,($A:$A<>"")*(c<>"")*(c>ROW()),""))(BYROW($B:$B,LAMBDA(r,IF(r<>"","",ROW(r))))),1),tbl,OFFSET($C3,0,0,MAX(nextEmptyRow)-ROW(),2),nRow,ROWS(tbl),sumProdVal,SUMPRODUCT(OFFSET(tbl,0,0,nRow-1,1),CHOOSECOLS(OFFSET(tbl,0,0,nRow-1,2),2)),divVal,CHOOSECOLS(CHOOSEROWS(tbl,nRow),1)-CHOOSECOLS(CHOOSEROWS(tbl,nRow),2),IF(ABS(sumProdVal/divVal)>0.01,"FAIL","VALID")),"")

See in this example:

Classeur1
ABCDE
1TypeStatusAmount%Valid/Fail
2Commercial REFAIL
3MF-1Good2095,00% 
4MF-2Good4088,00% 
5MF-3Good3092,00% 
6Total Good MF9090,90%FAIL
7MF-1Bad2082,00% 
8MF-2Bad1084,00% 
9MF-3Bad1073,00% 
10Total Bad MF4080,30%FAIL
11Office-1Good5094,00% 
12Office-2Good1094,00% 
13Office-3Good3091,00% 
14Office-4Good4092,00% 
15Total Good Office13092,70%FAIL
16Office-1Bad1071,00% 
17Office-2Bad1083,00% 
18Office-3Bad2078,00% 
19Office-4Bad5077,00% 
Feuil1
Cell Formulas
RangeFormula
E2:E19E2=IF(B2="",LET( nextEmptyRow,CHOOSEROWS(LAMBDA(c,FILTER(c,($A:$A<>"")*(c<>"")*(c>ROW()),""))(BYROW($B:$B,LAMBDA(r,IF(r<>"","",ROW(r))))),1), tbl,OFFSET($C3,0,0,MAX(nextEmptyRow)-ROW(),2), nRow,ROWS(tbl), sumProdVal,SUMPRODUCT(OFFSET(tbl,0,0,nRow-1,1),CHOOSECOLS(OFFSET(tbl,0,0,nRow-1,2),2)), divVal,CHOOSECOLS(CHOOSEROWS(tbl,nRow),1)-CHOOSECOLS(CHOOSEROWS(tbl,nRow),2), IF(ABS(sumProdVal/divVal)>0.01,"FAIL","VALID") ),"")


Bests regards,

Vincent
 
Upvote 0

Forum statistics

Threads
1,226,013
Messages
6,188,421
Members
453,473
Latest member
bbugs73

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