Monster Formula- ArrayFormula version?

LuminaryXion

New Member
Joined
Jul 23, 2012
Messages
6
Hi! I'm using Google sheets to handle some data I'm receiving on Google forms. Unfortunately I have to do some averaging of several columns based on some variable criteria.

Here's the monster formula that does what I want:

Excel Formula:
=iferror(average(filter({
ifna(filter('Form Responses 1'!$Q:$Q,'Form Responses 1'!$P:$P=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$S:$S,'Form Responses 1'!$R:$R=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$V:$V,'Form Responses 1'!$U:$U=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$Y:$Y,'Form Responses 1'!$X:$X=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$AB:$AB,'Form Responses 1'!$AA:$AA=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$AE:$AE,'Form Responses 1'!$AD:$AD=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0)},{
ifna(filter('Form Responses 1'!$Q:$Q,'Form Responses 1'!$P:$P=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$S:$S,'Form Responses 1'!$R:$R=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$V:$V,'Form Responses 1'!$U:$U=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$Y:$Y,'Form Responses 1'!$X:$X=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$AB:$AB,'Form Responses 1'!$AA:$AA=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0),
ifna(filter('Form Responses 1'!$AE:$AE,'Form Responses 1'!$AD:$AD=D2,'Form Responses 1'!$A:$A>($A2-7),'Form Responses 1'!$A:$A<=$A2),0)}>0)
),"")

In case it matters:
'Form Responses 1'!$A:$A
$A2
These are dates. So I'm looking to average any items submitted within 7 days of the current listing (A2 is the current listing in this example) .

D2 is the item name of the current listing, as are the items being compared to it.

Anything else is the cost of that item.

Now, I can easily just copy and paste this formula into each row, all the way down, but I'd prefer a version that uses ArrayFormula or something similar, so that it will automatically expand when I have new data added to my form.

Can anyone help?

Thank you!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,361
Messages
6,171,632
Members
452,411
Latest member
sprichwort

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