excel - SUMPRODUCT that counts unique text values -


i have data set looks this:

opendate      name      filldate      daystofill 12/05/13      samuel        -           open 01/01/14      anne      01/16/14        16 01/12/14      mike      01/25/14        13 01/28/14      anne      01/31/14         3 

i have dashboard creating metrics. there data validation list in user picks month want information about. choice triggers change in 2 cells -- r2 , r3. r2 corresponds month , generates numeric value of month (jan =1, feb = 2, etc) , r3 generates last day in month current year (jan = 01/31/14, feb = 02/28/14).

i have formula counts number of entries meet either of conditions below:

(i) daystofill > 0  , filldate in month chosen (in r2) 

or

(ii) daystofill = "open" , opendate < last day of month chosen (in r3) 

i have following sumproduct formula calculates this:

=sumproduct(--(isnumber(data!i2:i30)),--(month(data!i2:i30)=sheet1!r2),  --(data!j2:j30>0))+sumproduct(--(isnumber(data!c2:c30)),  --((data!c2:c30)<=sheet1!r3),--(data!j2:j30="open")) 

where

column c = opendate; column = filldate; column j = daystofill, , column h (which isn't used here) name

this works fine, i need way add condition on above formula -- need way count unique names meet conditions. above data, if user chooses january, output formula have 4 [3 meet conditions in (i) , 1 meets conditions in (ii)]. but, if additional layer of unique recruiters, should 3 (because anne counted twice). i'm having hard time seeing how approach this. appreciated.

you can use "array formula"

=sum(if(frequency(if(isnumber(data!i2:i30)*(month(data!i2:i30)=sheet1!r2)*(data!j2:j30>0)+isnumber(data!c2:c30)*(data!c2:c30<=sheet1!r3)*(data!j2:j30="open"),if(h2:h30<>"",match(h2:h30,h2:h30,0))),row(h2:h30)-row(h2)+1),1))

confirmed ctrl+shift+enter

note i'm not sure if original formula has flaw because data!j2:j30>0 return true cells contain "open". condition achieve anything, if j2:j30 contains date or "open" part return true everything.....


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -