CountIfs Formula - Treating One Column Differently

WednesdayC

Board Regular
Joined
Nov 7, 2010
Messages
201
Office Version
  1. 2016
Platform
  1. MacOS
Hi All

I need some help please.

This is easier to explain with an example:-

Ref
Invoice NoType
A
1000X
A
1000X
B500Y
B
600X
C
700Y
A800Z
D
900Z
E
950Y
D
900Z
Current ResultRequired ResultCurrent ResultRequired ResultCurrent ResultRequired Result
XXYYZZ
A
210011
B
111100
C
001100
D
000021
E
001100

<colgroup><col style="mso-width-source:userset;mso-width-alt:1682;width:46pt" width="46"> <col style="mso-width-source:userset;mso-width-alt:3328;width:91pt" width="91"> <col style="mso-width-source:userset;mso-width-alt:3584;width:98pt" width="98"> <col style="mso-width-source:userset;mso-width-alt:3035;width:83pt" width="83"> <col style="mso-width-source:userset;mso-width-alt:3254;width:89pt" width="89"> <col style="mso-width-source:userset;mso-width-alt:3145;width:86pt" width="86"> <col style="mso-width-source:userset;mso-width-alt:3474;width:95pt" width="95"> </colgroup><tbody>
</tbody>
<style>table { }td { padding-top: 1px; padding-right: 1px; padding-left: 1px; color: black; font-size: 10pt; font-weight: 400; font-style: normal; text-decoration: none; font-family: Georgia, sans-serif; vertical-align: bottom; border: medium none; white-space: nowrap; }.xl63 { background: yellow none repeat scroll 0% 0%; }.xl64 { font-weight: 700; }.xl65 { font-weight: 700; text-align: center; }.xl66 { text-align: center; }.xl67 { text-align: center; background: yellow none repeat scroll 0% 0%; }</style>

I am trying to count the number of occurrences of the raw data above, but when there are duplicate invoices, only count the result once.

The formula I have so far is:-

HTML:
=COUNTIFS($A$3:$A$11,$A17,$C$3:$C$11,B$16)

However, I can't work out how to ignore the result for duplicate invoice numbers.

If a UDF is required here, please could you help me with the code.

Many thanks

Wednesday
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi

you could use a helper column in D3:D11 using in D3 to be copied down

Code:
=--(COUNTIFS($A$3:A3,A3,$C$3:C3,C3)=1)

to be read by a SUMIFS in B17 to be copied across

Code:
=SUMIFS($D$3:$D$11,$A$3:$A$11,$A17,$C$3:$C$11,B$16)

or in B17 to be confirmed with control+shift+enter

Code:
=SUM(IF(FREQUENCY(IF($A$3:$A$11&$C$3:$C$11=$A17&B$16,MATCH($C$3:$C$11,$C$3:$C$11,0)),ROW($3:$11)-ROW($A$3)+1),1))

Hope it helps
 
Upvote 0
Hi Canapone

Thank you so much.

The array formula suits my purposes perfectly, as I prefer not to introduce an extra column.

Regards

Wednesday
 
Upvote 0

Forum statistics

Threads
1,214,909
Messages
6,122,189
Members
449,072
Latest member
DW Draft

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