vba - Excel Array formula with IF statement -


i not great array formulas in excel thought maybe in community might able me. have data in 2 seperate worksheets , trying sum information given parameters. first worksheet looks

start date   end date   division , group total 10/1/2011   10/31/2011   [need sum here] 11/1/2011   11/30/2011   [need sum here]     .            .     .            .     .            . 03/01/2015   03/31/2015  [need sum here] 

the second worksheet contains information follows:

year      jan feb mar apr  ...  dec     division   group 2011       1   2   3   4   ...  21       retail      2011       5   6   7   8   ...   2       mgmt        b   .        .   .   .   .   ...   .        mw         c   .        .   .   .   .   ...   .        bb         d   .        .   .   .   .   ...   .        .          . 2015       5   5   5   5   ...   1       retail      j 

the group variable has 10 different distinct values while division has 4. appreciated.

you might want sumproduct. can use match multiple cells in row , sum them up. example

=sumproduct((a1:a10=2011)*(h1:h10="retail")*(i1:i10="a")*f1:f10) 

just change letters matches sheet. cell format type important. example see 2011 unquoted because stored number. if stored text need "2011". f corresponds column want total. in case october column. can add more criteria or subtract it.

you can add year dynamically off start date with

year(a1) 

and make decisions based on more 1 criteria per column or or and

=sumproduct((a1:a10=year(sheet1!a1))*(h1:h10="retail")*or((i1:i10="a"),(i1:i10="b"))*f1:f10) 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -