excel - Find distinct values based upon multiple columns -
i have spreadsheet of sales (to keep example simple) 3 columns
name -- state -- country
it's easy find how many sales. (sum lines) can find out how many customers have how finding out how many customers particular state (and country)
name -- state -- country p1----- ca------ usa p2----- ca------ usa p1----- ca------ usa p1----- ca------ usa p3----- ny------ usa p3----- ny------ usa
the above example give 2 unique customers ca , 1 unique customer ny , 3 usa
edit:
the desired result above table
state - unique customers ca ---- 2 ny ---- 1 country - unique customers usa ---- 3
assuming data have headers in row 1 of columns a, b, , c, follow these directions.
in cell f1 enter state.
in cell g1 enter count.
in cell f2 enter array-formula (must confirmed ctrl+shift+enter↵):
=iferror(index(b$2:index(b:b,counta(b:b)),match(0,countif(f$1:f1,b$2:index(b:b,counta(b:b))),)),"")
in cell g2 enter regular formula (confirmed enter):
=if(len(f2),countif(b2:b13,f2),"")
select f2:g2
, copy.
now select f3:f51
, paste.
update
the nature of question changed. first formula same before. gets distinct states in source data , culls them display no blanks.
the second formula different. needs count number of distinct customers in each state, , array formula confirmed ctrl+shift+enter↵).
=if(len(f2),sum(if(f2=$b$2:$b$50,1/(countifs($b$2:$b$50,f2,$a$2:$a$50,$a$2:$a$50)),)),"")
Comments
Post a Comment