Sumproduct, Countif, Avoid Duplicates, Left - Not Calculating Correctly!

Excel LVP

New Member
Joined
Aug 31, 2018
Messages
2
Hello - I have been stuck on this formula for a few hours. It is the last one I need for this report.


Here is mycurrent formula:

=SUMPRODUCT((1/COUNTIF(CIF,CIF&""))*(--(LEFT(Officer,3)=D2)))

CIF = my rangename for each customer’s ID, which consists of three letters and four numbers.

Officer = myrange name for each officer’s initials, which consists of three letters. I amusing “LEFT” because the data import adds three spaces at the end of theofficer’s initials.

D2 = thespecific officer for this table.

My intent with the formulais to count the number of unique CIF for each Officer. For my test officer, m y result shouldbe 121 but I am getting 119.25. Not sure why it is not a whole number or why itis slightly off. Any advice based on this information?


[FONT=&quot]Here is kind of a sample of what the data looks like – I forgotto put column titles but the first one would be officer and the second would beCIF. There are multiple officers but I just showed one. Just imagine that afterADS is three blank spaces – which is why I need the “LEFT” in there. So thereare actually 180 rows for ADS but I am just showing a sample of what 10 wouldlook like. Based on these 10, my formula should show 8 as an answer. [/FONT]

[TABLE="class: cms_table, width: 500"]
<tbody>[TR]
[TD]ADS[/TD]
[TD]AAA0112[/TD]
[/TR]
[TR]
[TD]ADS[/TD]
[TD]AAA0112[/TD]
[/TR]
[TR]
[TD]ADS[/TD]
[TD]AAA0234[/TD]
[/TR]
[TR]
[TD]ADS[/TD]
[TD]BAA0123[/TD]
[/TR]
[TR]
[TD]ADS[/TD]
[TD]BAA1567[/TD]
[/TR]
[TR]
[TD]ADS[/TD]
[TD]CAA0021[/TD]
[/TR]
[TR]
[TD]ADS[/TD]
[TD]CAA0021[/TD]
[/TR]
[TR]
[TD]ADS[/TD]
[TD]DAA0011[/TD]
[/TR]
[TR]
[TD]ADS[/TD]
[TD]EAA0344[/TD]
[/TR]
[TR]
[TD]ADS[/TD]
[TD]EAA4559[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited by a moderator:

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Welcome to Mr Excel forum

Try


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Officer​
[/td][td]
CIF​
[/td][td][/td][td]
Criteria​
[/td][td]
Result​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
ADS​
[/td][td]
AAA0112​
[/td][td][/td][td]
ADS​
[/td][td]
8​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
ADS​
[/td][td]
AAA0112​
[/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
ADS​
[/td][td]
AAA0234​
[/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
ADS​
[/td][td]
BAA0123​
[/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
ADS​
[/td][td]
BAA1567​
[/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
ADS​
[/td][td]
CAA0021​
[/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
ADS​
[/td][td]
CAA0021​
[/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td]
ADS​
[/td][td]
DAA0011​
[/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/td][td]
ADS​
[/td][td]
EAA0344​
[/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
11
[/td][td]
ADS​
[/td][td]
EAA4559​
[/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
12
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Criteria in D2

Array formula in E2
=SUM(IF(FREQUENCY(IF(LEFT(A2:A100,3)=D2,MATCH(B2:B100,B2:B100,0)),ROW(B2:B100)-ROW(B2)+1),1))
confirmed with Ctrl+Shift+Enter, not just Enter

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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