Countif for Unique Values with a second range

helpme20

Board Regular
Joined
Aug 28, 2010
Messages
102
What is the proper way to write the countif formula if I have Column A being A1:A685 with different customer names and In Column B1:B685 you have the Sales Reps name that handles the account.

Column B might contain about 8 different sales reps names.

Can someone tell me the proper way to write this formula?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
If you have Excel 2007, you would want to use Countifs formula.

Type

=Countifs(

then click on the Fx button in the formula bar or hit Shift+f3 and a popup box will appear and it will walk you through it.
 
Upvote 0
What is the proper way to write the countif formula if I have Column A being A1:A685 with different customer names and In Column B1:B685 you have the Sales Reps name that handles the account.

Column B might contain about 8 different sales reps names.

Can someone tell me the proper way to write this formula?

Are you trying to determine (count) how many distinct customers are per sales rep?
 
Upvote 0
Yes, using 2007 and trying to count the unique/distinct customers each rep has.

Let...

C1: Mark
C2: Jon
Etc...


D1, control+shift+enter, not just enter, and copy down:
Code:
=SUM(IF(FREQUENCY(IF($A$1:$A$685<>"",IF($B$1:$B$685=C1,
    MATCH($A$1:$A$685,$A$1:$A$685,0))),
     ROW($A$1:$A$685)-ROW($A$1)+1),1))
 
Upvote 0
What is the proper way to write the countif formula if I have Column A being A1:A685 with different customer names and In Column B1:B685 you have the Sales Reps name that handles the account.

Column B might contain about 8 different sales reps names.

Can someone tell me the proper way to write this formula?
Try this...

Book1
ABCDE
2Customer2Rep1_Rep12
3Customer8Rep1_Rep23
4Customer8Rep1_Rep31
5Customer1Rep2_Rep40
6Customer5Rep2_Rep53
7Customer9Rep2_Rep63
8Customer10Rep3_Rep71
9Customer10Rep3_Rep84
10Customer3Rep5___
11Customer8Rep5___
12Customer10Rep5___
13Customer3Rep6___
14Customer4Rep6___
15Customer7Rep6___
16Customer9Rep7___
17Customer3Rep8___
18Customer5Rep8___
19Customer6Rep8___
20Customer8Rep8___
Sheet1
This array formula** entered in E2 and copied down:

=SUM(IF(FREQUENCY(IF(B$2:B$20=D2,MATCH(A$2:A$20,A$2:A$20,0)),ROW(A$2:A$20)-ROW(A$2)+1),1))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

Assumes no empty cells within the customer range of column A.
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,136
Members
452,890
Latest member
Nikhil Ramesh

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