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:
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!
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!