Hello, Im trying to write a formula that calculates an average for a location under a specific period.
I have to specify the start and end dates and also the location and then get the average.
With one location I was able to calculate the average using averageifs, but if there are multiple locations I don't know how to make it go calculate the average on the correct column. The data set is a few hundred columns long, so when I specify the location I need the formula to use it to refer to the correct column in the spreadsheet.
For example, the formula should return the following 2 results for the dataset at the below.
[TABLE="width: 286"]
<tbody>[TR]
[TD]Start
[/TD]
[TD][/TD]
[TD]End
[/TD]
[TD][/TD]
[TD]Location
[/TD]
[TD="align: right"]Average
[/TD]
[/TR]
[TR]
[TD]2/1/2018
[/TD]
[TD][/TD]
[TD]5/31/2018
[/TD]
[TD][/TD]
[TD="align: center"]C
[/TD]
[TD="align: center"]4.25
[/TD]
[/TR]
[TR]
[TD]8/1/2018
[/TD]
[TD][/TD]
[TD]11/30/2018
[/TD]
[TD][/TD]
[TD="align: center"]D
[/TD]
[TD="align: center"]6
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 388"]
<tbody>[TR]
[TD] Date
[/TD]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[/TR]
[TR]
[TD]1/1/2017
[/TD]
[TD][/TD]
[TD]5.00
[/TD]
[TD]2.00
[/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[/TR]
[TR]
[TD]2/1/2017
[/TD]
[TD][/TD]
[TD]8.00
[/TD]
[TD]7.00
[/TD]
[TD]4.00
[/TD]
[TD]1.00
[/TD]
[TD]5.00
[/TD]
[/TR]
[TR]
[TD]3/1/2017
[/TD]
[TD][/TD]
[TD]5.00
[/TD]
[TD]9.00
[/TD]
[TD]8.00
[/TD]
[TD]9.00
[/TD]
[TD]6.00
[/TD]
[/TR]
[TR]
[TD]4/1/2017
[/TD]
[TD][/TD]
[TD]0.00
[/TD]
[TD]1.00
[/TD]
[TD]1.00
[/TD]
[TD]4.00
[/TD]
[TD]4.00
[/TD]
[/TR]
[TR]
[TD]5/1/2017
[/TD]
[TD][/TD]
[TD]9.00
[/TD]
[TD]8.00
[/TD]
[TD]4.00
[/TD]
[TD]4.00
[/TD]
[TD]4.00
[/TD]
[/TR]
[TR]
[TD]6/1/2017
[/TD]
[TD][/TD]
[TD]8.00
[/TD]
[TD]7.00
[/TD]
[TD]4.00
[/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[/TR]
[TR]
[TD]7/1/2017
[/TD]
[TD][/TD]
[TD]1.00
[/TD]
[TD]7.00
[/TD]
[TD]1.00
[/TD]
[TD]0.00
[/TD]
[TD]7.00
[/TD]
[/TR]
[TR]
[TD]8/1/2017
[/TD]
[TD][/TD]
[TD]7.00
[/TD]
[TD]4.00
[/TD]
[TD]6.00
[/TD]
[TD]8.00
[/TD]
[TD]3.00
[/TD]
[/TR]
[TR]
[TD]9/1/2017
[/TD]
[TD][/TD]
[TD]5.00
[/TD]
[TD]3.00
[/TD]
[TD]6.00
[/TD]
[TD]4.00
[/TD]
[TD]0.00
[/TD]
[/TR]
[TR]
[TD]10/1/2017
[/TD]
[TD][/TD]
[TD]4.00
[/TD]
[TD]0.00
[/TD]
[TD]2.00
[/TD]
[TD]4.00
[/TD]
[TD]2.00
[/TD]
[/TR]
[TR]
[TD]11/1/2017
[/TD]
[TD][/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[TD]3.00
[/TD]
[TD]8.00
[/TD]
[TD]9.00
[/TD]
[/TR]
[TR]
[TD]12/1/2017
[/TD]
[TD][/TD]
[TD]8.00
[/TD]
[TD]8.00
[/TD]
[TD]0.00
[/TD]
[TD]9.00
[/TD]
[TD]6.00
[/TD]
[/TR]
</tbody>[/TABLE]
I have to specify the start and end dates and also the location and then get the average.
With one location I was able to calculate the average using averageifs, but if there are multiple locations I don't know how to make it go calculate the average on the correct column. The data set is a few hundred columns long, so when I specify the location I need the formula to use it to refer to the correct column in the spreadsheet.
For example, the formula should return the following 2 results for the dataset at the below.
[TABLE="width: 286"]
<tbody>[TR]
[TD]Start
[/TD]
[TD][/TD]
[TD]End
[/TD]
[TD][/TD]
[TD]Location
[/TD]
[TD="align: right"]Average
[/TD]
[/TR]
[TR]
[TD]2/1/2018
[/TD]
[TD][/TD]
[TD]5/31/2018
[/TD]
[TD][/TD]
[TD="align: center"]C
[/TD]
[TD="align: center"]4.25
[/TD]
[/TR]
[TR]
[TD]8/1/2018
[/TD]
[TD][/TD]
[TD]11/30/2018
[/TD]
[TD][/TD]
[TD="align: center"]D
[/TD]
[TD="align: center"]6
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 388"]
<tbody>[TR]
[TD] Date
[/TD]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[/TR]
[TR]
[TD]1/1/2017
[/TD]
[TD][/TD]
[TD]5.00
[/TD]
[TD]2.00
[/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[TD]6.00
[/TD]
[/TR]
[TR]
[TD]2/1/2017
[/TD]
[TD][/TD]
[TD]8.00
[/TD]
[TD]7.00
[/TD]
[TD]4.00
[/TD]
[TD]1.00
[/TD]
[TD]5.00
[/TD]
[/TR]
[TR]
[TD]3/1/2017
[/TD]
[TD][/TD]
[TD]5.00
[/TD]
[TD]9.00
[/TD]
[TD]8.00
[/TD]
[TD]9.00
[/TD]
[TD]6.00
[/TD]
[/TR]
[TR]
[TD]4/1/2017
[/TD]
[TD][/TD]
[TD]0.00
[/TD]
[TD]1.00
[/TD]
[TD]1.00
[/TD]
[TD]4.00
[/TD]
[TD]4.00
[/TD]
[/TR]
[TR]
[TD]5/1/2017
[/TD]
[TD][/TD]
[TD]9.00
[/TD]
[TD]8.00
[/TD]
[TD]4.00
[/TD]
[TD]4.00
[/TD]
[TD]4.00
[/TD]
[/TR]
[TR]
[TD]6/1/2017
[/TD]
[TD][/TD]
[TD]8.00
[/TD]
[TD]7.00
[/TD]
[TD]4.00
[/TD]
[TD]6.00
[/TD]
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