Question

I have an excel file with several sheets. One sheet, Program Data, contains all of the manual entries. A very basic approximation of this data looks like this:

ID     Type     Route     RevACT Aug 2013     RevBGT Aug 2014 ...
250    New      CCS           $1000.00           $500.00
310    Deep     RCS           $750.00            $150.00
015    Exist    CCS           $250.00            $1000.00

What we're doing is a two-part step which I'm hoping to condense to one step...

Right now we use a sumif statement to pull needed info from this sheet to a second sheet (named New & Exst Dasbrd-Bckup) using this formula:

=SUMIFS('Program Data'!CC:CC,'Program Data'!$M:$M,$A74,'Program Data'!$E:$E,'Program Data'!$E$2)+SUMIFS('Program Data'!CC:CC,'Program Data'!$M:$M,$A74,'Program Data'!$E:$E,'Program Data'!$E$3)

This formula looks for a values that match criteria in A74 (which is Route = CCS), Then adds up the values for Aug Revenue (Found in column CC) where the Type is "New" (E2) or "Existing" (E3).

Once we have this data compiled for various months, we have a dashboard that allows us to create graphs. There is a pull-down menu to select the month you want (Jan - Dec) and it fills in the cells using the second sheet and based on your drop-down choice using this formula:

=HLOOKUP($A$11,'New & Exst Dshbrd-Bckup'!$B$74:$M$77,3,FALSE)

Where A11 is the drop-down choice (Jan - Aug), the range is where the first set of values is located, and 3 is the row containing the previous formulas' values. I am really hoping we can accomplish this with a single formula and skip the interm sheet.

TL DR; I need a single formala that, once you select a month from the drop-down menu (in A11), will look for that string (Aug, Oct, etc) along with another string I specify (say "2013") in a column header (1:1). Once it finds the column with those two strings, I want it to seach that column and add up all the values that have the specified Route (as stated in A74 = CCS) and also have the correct Type values (Given in E2 and E3 -- New and Exist) and return that value

I've tried a few different things, but I'm afraid that this is a bit beyond my capabilities. Any help is sincerely appreciated.

Was it helpful?

Solution

Firstly you can use a single SUMIFS like this to simplify your first formula

=SUMPRODUCT(SUMIFS('Program Data'!CC:CC,'Program Data'!$M:$M,$A74,'Program Data'!$E:$E,'Program Data'!$E$2:$E$3))

Now you just need to make the column to sum dynamic based on month and year, so assuming your sum column is somewhere between A and CZ you can use an INDEX/MATCH function in that part, i.e.

=SUMPRODUCT(SUMIFS(INDEX('Program Data'!A:CZ,0,MATCH("*"&A11&" "&A12&"*",A1:CZ1,0)),'Program Data'!$M:$M,$A74,'Program Data'!$E:$E,'Program Data'!$E$2:$E$3))

where A12 contains the year

Note: SUMPRODUCT is only used here to add 2 values - because one of the SUMIFS criteria is a 2 cell range - 'Program Data'!$E$2:$E$3 - SUMIFS will return a two-element array. Most of the hard work of the formula is done by SUMIFS. This is deliberate because SUMIFS is quicker than any other multi-conditional summing functions

OTHER TIPS

Looks like Barry beat me to it, here's my take. I think Barrys formula is better using INDEX / MATCH, but the SUMIF is unnecessary.

    Col D   E       F       G               H               I                   J
Row                             
9       ID  Type    Route   RevACT Aug 2013 RevBGT Aug 2014 RevACT Sept 2013    RevBGT Sept 2014
10      250 New     CCS     1000            500             500                 250
11      310 Deep    RCS     750             150             650                 1500
12      15  Exist   CCS     250             1000            350                 2000
13                              
14      Route   RCS             Answer  650
15      Month   RevACT Sept 2013                Formula =SUMPRODUCT(--(F10:F12=$E$14),INDIRECT(VLOOKUP($E$15,{"RevACT Aug 2013","G";"RevBGT Aug 2014","H";"RevACT Sept 2013","I";"RevBGT Sept 2014","J"},2,0)&"10:"&VLOOKUP($E$15,{"RevACT Aug 2013","G";"RevBGT Aug 2014","H";"RevACT Sept 2013","I";"RevBGT Sept 2014","J"},2,0)&"12"))

Note the double minus and parenthesis surrpunding the first argument of SUMPRODUCT, this converts the TRUE / FALSE evaluation to 1 / 0 for multiplication.

Also, the syntax may vary on the array argument within the VLOOKUP depending on your system delimiters etc.

Another way to solve this would be to go strait to array formulas, although the result would be essentially the same as the solutions given.

Regards,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top