SumIf with dynamic column from Drop Down

ekdrake

New Member
Joined
Feb 19, 2018
Messages
2
Hello. I am trying to create a SumIf that changes columns depending on the dropdown value selected. I have tried Indirect, Match, and Offset, but I just can't figure it out. I'm frustrated because I've been trying for days and I know this should be simple!!

Basically, B1 is my drop down, which has subgroup options that match F2 to O2. My SumIf in C1 says: =SUMIFS(F3:F324,A3:A324,"=1"). How do I revise my basic formula to get F3:F324 to change columns dynamically based on what's selected in B1?

Thanks!

Excel 2016 (Windows) 32 bit
ABCDEFGHIJKLMNO
1Select Subgroup =>Total149,024,359
2Sumif IndicatorLookupID:YearAge GroupTotalMale TotalFemale TotalWhite TotalWhite MaleWhite FemaleBlack TotalBlack MaleBlack FemaleAIAN Total
320000-420000-4394,303202,064192,240319,901164,339155,56216,8068,5588,2498,093
4120005-920005-9425,908218,500207,409351,166180,308170,85818,1179,3478,7709,129
51200010-14200010-14434,835222,937211,899362,011185,615176,39617,9389,3628,5769,747
61200015-19200015-19427,965220,407207,557356,013183,846172,16716,6778,9197,7589,067
71200020-24200020-24390,193200,816189,377324,005167,146156,85916,2468,9777,2697,584
81200025-29200025-29403,652206,789196,863336,267172,774163,49316,3059,0317,2747,407
9200030-34200030-34437,480223,413214,067371,256190,431180,82617,5839,8027,7817,474
10200035-39200035-39483,948244,034239,914416,878211,071205,80718,56810,2918,2778,032
11200040-44200040-44491,145246,268244,877428,300215,729212,57217,0989,6587,4417,767
12200045-49200045-49454,231225,512228,719401,403200,204201,19913,1167,3545,7626,552
13200050-54200050-54391,757195,063196,694350,576175,406175,1719,6325,2184,4155,211

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Test
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Try this:
Code:
=SUM(INDEX(D3:P13,0,MATCH(B1,D2:P2,0)))

This will sum the column, which is constrained in the first range D3:P13, change as needed. The match clearly is looking at your dropdown and comparing with the 2nd row.
 
Upvote 0
Or this if you want to use the 1 in column A

=SUMIFS(INDEX(D3:O13,,MATCH(B1,D2:O2,0)),A3:A13,1)


This works!!! Thank you so much! I don't know whether to laugh or cry given how much time I've spent on this!

I think I was going wrong on the INDEX, where you skip the row argument with the ",,". I also learned that I can just put the 1 for the sumif instead of "=1". I didn't know that.

At any rate, this works! Thank you.:)
 
Upvote 0
.. and another option would be
=SUMPRODUCT(F3:O13,(F2:O2=B1)*(A3:A13=1))
 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,413
Members
449,082
Latest member
tish101

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