different calculation based on dropdown list

skykaiz

New Member
Joined
Sep 19, 2019
Messages
3
Hello guys,

I have got a questions regarding different calculations based on the selection of the drop-down list. In other words, how can I have different calculations based on what variable I select in the drop-down-list?


For example, let's say I've got 5 companies and I created a drop-down list where I can select one company.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Company A[/TD]
[/TR]
[TR]
[TD]Company B[/TD]
[/TR]
[TR]
[TD]Company C[/TD]
[/TR]
[TR]
[TD]Company D[/TD]
[/TR]
[TR]
[TD]Company E[/TD]
[/TR]
</tbody>[/TABLE]

Then I got the data like sales per week and a variable total sales:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Sales per week[/TD]
[TD]Mon[/TD]
[TD]Tue[/TD]
[TD]Wed[/TD]
[TD]Thu[/TD]
[TD]Fri[/TD]
[/TR]
[TR]
[TD]Company A[/TD]
[TD]21[/TD]
[TD]12[/TD]
[TD]31[/TD]
[TD]12[/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD]Company B[/TD]
[TD]24[/TD]
[TD]26[/TD]
[TD]21[/TD]
[TD]26[/TD]
[TD]11[/TD]
[/TR]
[TR]
[TD]Company C[/TD]
[TD]12[/TD]
[TD]15[/TD]
[TD]12[/TD]
[TD]17[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]Company D[/TD]
[TD]12[/TD]
[TD]11[/TD]
[TD]31[/TD]
[TD]27[/TD]
[TD]21[/TD]
[/TR]
[TR]
[TD]Company E[/TD]
[TD]21[/TD]
[TD]22[/TD]
[TD]26[/TD]
[TD]15[/TD]
[TD]12[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 500"]
<tbody>[TR]
[TD]Total sales[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Now I would like to calculate total sales, which is Sum(Mon:Fri), but based on what Company I select in the drop down list e.g. if I select Company A, it should calculate Sum(21:21), if I select Company B then Sum(24:11) and so on.


How can I make it happen in excel?

Thanks a lot!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Maybe something like


Book1
ABCDEFGHIJ
1Sales per weekMonTueWedThuFri
2Company A2112311221Company A
3Company B242621261197
4Company C1215121712
5Company D1211312721
6Company E2122261512
Report
Cell Formulas
RangeFormula
J3=SUM(INDEX(B2:F6,MATCH(J2,A2:A6,0),0))
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
Members
453,021
Latest member
Justyna P

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