Sumif, Countif, Averageif, maxif, minif; with dynamic column formula

Bizza

New Member
Joined
Jun 18, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi groovy people. This is my very first thread and it may be a doozy! I hope someone with supernatural abilities in excel can solve this one!

So, all I want to do is get the average of an entire column using the AVERAGEIFS function. The column however, changes depending on what has been chosen from a dropdown list of all the column names. I just want a formula without using named ranges, or VBA, array or anything else. Is this possible?

DynamicColumnLookup.xlsx
A
1Date
Sheet1


Thanks in advance groovers!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
DynamicColumnLookup.xlsx
ABCDEFGHIJKLMN
1DateApplesBananasCarrotsTomatoesFruit/Veg Sales
25/08/20215387Choose Fruit/VegBananas<dropdown
36/08/2021861110Date from7/08/2021
47/08/20211043Date to13/08/2021
58/08/20216498Total23=SUMIFS(C:C,$A:$A,">="&H3,A:A,"<="&H4)
69/08/20214276Average3.3=AVERAGEIFS(C:C,$A:$A,">="&H3,A:A,"<="&H4)
710/08/20211191413* the column is only looking up "Bananas" column.
811/08/2021861110* How can it lookup ANY column chosen in the dropdown?
912/08/20214276
1013/08/20211043
1114/08/20212054
1215/08/2021971211
13Total59399281
14Average5.43.58.47.4
Sheet1
Cell Formulas
RangeFormula
H5H5=SUMIFS(C:C,$A:$A,">="&H3,A:A,"<="&H4)
H6H6=AVERAGEIFS(C:C,$A:$A,">="&H3,A:A,"<="&H4)
B13:E13B13=SUM(B2:B12)
B14:E14B14=AVERAGE(B2:B12)
Cells with Data Validation
CellAllowCriteria
H2List=$B$1:$E$1
 
Upvote 0
How about
Excel Formula:
=AVERAGEIFS(INDEX(B:E,,MATCH(H2,B1:E1,0)),$A:$A,">="&H3,A:A,"<="&H4)
and
Excel Formula:
=SUMIFS(INDEX(B:E,,MATCH(H2,B1:E1,0)),$A:$A,">="&H3,A:A,"<="&H4)
 
Upvote 0
Solution
How about
Excel Formula:
=AVERAGEIFS(INDEX(B:E,,MATCH(H2,B1:E1,0)),$A:$A,">="&H3,A:A,"<="&H4)
and
Excel Formula:
=SUMIFS(INDEX(B:E,,MATCH(H2,B1:E1,0)),$A:$A,">="&H3,A:A,"<="&H4)
As simple as that! lol
And I tried the index/match but couldn't get it to work. Thanks so much :)
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

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