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]

ADSAAA0112
ADSAAA0112
ADSAAA0234
ADSBAA0123
ADSBAA1567
ADSCAA0021
ADSCAA0021
ADSDAA0011
ADSEAA0344
ADSEAA4559

<tbody>
</tbody>
 
Last edited by a moderator:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Welcome to Mr Excel forum

Try


A
B
C
D
E
1
Officer​
CIF​
Criteria​
Result​
2
ADS​
AAA0112​
ADS​
8​
3
ADS​
AAA0112​
4
ADS​
AAA0234​
5
ADS​
BAA0123​
6
ADS​
BAA1567​
7
ADS​
CAA0021​
8
ADS​
CAA0021​
9
ADS​
DAA0011​
10
ADS​
EAA0344​
11
ADS​
EAA4559​
12

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,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

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