Conditional sum or average from list of cells based on dependent dropdown values from different cells

Mtalreja93

New Member
Joined
Sep 10, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Cell 1 : User can select Frequency: Monthly / Quarterly / Yearly
Cell 2: User can select Type of Function : Sum or Average
Cell 3-19: Have values for each Month, Quarter and Year

Now, How generate result applying condition that based on choice ( type of Frequency ) - excel picks only those values from Cell 3-19 and performs function that user has selected in Cell 2, either sum or average

S.NoUnitFrequencyQ1Q2Q3Q4M1M2M3M4M5M6M7M8M9M10M11M12YResult
1SUM / Average Yearly / Quarterly / Monthly11111111111111111
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello there, just add the following formula in Results Column
Excel Formula:
=IFS(AND(A2="Sum",B2="Monthly"),SUM(G2:R2),AND(A2="Sum",B2="Quarterly"),SUM(C2:F2),AND(A2="Sum",B2="Yearly"),S2,AND(A2="Average",B2="Monthly"),AVERAGE(G2:R2),AND(A2="Average",B2="Quarterly"),AVERAGE(C2:F2),AND(A2="Average",B2="Yearly"),AVERAGE(S2))
 
Upvote 0
Welcome to the MrExcel board!

See if this would suit you.

22 09 11.xlsm
BCDEFGHIJKLMNOPQRSTU
1UnitFrequencyQ1Q2Q3Q4M1M2M3M4M5M6M7M8M9M10M11M12YResult
2SumQuarterly111111111111111114
3AverageMonthly111111111111111111
4SumYearly111111111111111111
5SumMonthly1111111111111111112
Sum or Average
Cell Formulas
RangeFormula
U2:U5U2=LET(r,FILTER(D2:T2,LEFT(D$1:T$1,1)=LEFT(C2,1)),IF(B2="Sum",SUM(r),AVERAGE(r)))
Cells with Data Validation
CellAllowCriteria
B2:B5ListSum,Average
C2:C5ListYearly,Quarterly,Monthly
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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