# Formula help, counting unique occurences.

#### J2Reed

##### New Member
I am looking for a formula that will count unique occurrences that start with W81UTH, ignoring duplicates and blank cells.
Also looking for a formula that will count unique occurrences that does NOT start with W81UTH, ignoring duplicates and blank cells.
I want to achieve the desired results below in cells D3 and D4.

#### DanteAmor

##### Well-known Member
Try this ARRAY formula (Entered with Ctrl+Shift+Enter)

xl2bb.xlam
ABCD
1W81UTHa1
2W81UTHa2
3W81UTHa3STARTS WITH W81UTH
5W81UTHa1
6W81UTHa2
7W81UTHa3
8
9W50abcd1
10W50abcd2
11W50abcd3
12
13W50abcd1
14W50abcd2
15W50abcd3
16W50abcd4
17W50abcd5
18W50abcd6
19W50abcd7
20W50abcd8
21W50abcd9
 Hoja15
Cell Formulas
Range(s)Formula
D3D3{=SUM(IF(FREQUENCY(IF(LEFT(\$A\$1:\$A\$21,6)="W81UTH",MATCH(\$A\$1:\$A\$21,\$A\$1:\$A\$21,0)),ROW(\$A\$1:\$A\$21)-ROW(\$A\$1)+1),1))}
D4D4{=SUM(IF(FREQUENCY(IF((A1:A21<>"")*(LEFT(\$A\$1:\$A\$21,6)<>"W81UTH"),MATCH(\$A\$1:\$A\$21,\$A\$1:\$A\$21,0)),ROW(\$A\$1:\$A\$21)-ROW(\$A\$1)+1),1))}
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.

#### realdemigod

##### New Member
You can try removing the duplicates in the column from the Data on the menu and then use the following.

In the formula below use the '?' as many times as the remaining text of the string. This would work if the length is same for all the cells in which the string is present.

`COUNTIF(A2:A28,"W81UTH?????")`

For the second thing, `COUNTA(A2:A28)-the above formula`

#### hajiali

##### Board Regular
Another approach would be using column B or any other columns as helper. In column
B1"=LEFT(A1,6)" Drag down then
D3="=COUNTIF(\$B\$1:\$B\$28,"W81UTH")"
D4="=COUNTIF(\$A\$1:\$A\$28,"<>")-COUNTIF(\$C\$1:C28,"W81UTH")"

to clean it up you can just hide the Helper Column B

#### J2Reed

##### New Member
Thanks for the help, it worked.

Youre welcome!

1,081,560
Messages
5,359,608
Members
400,538
Latest member
leon_oscar

### This Week's Hot Topics

• VBA (Userform)
Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
• List box that changes fill color
Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
• Remove duplicates and retain one. Cross-linked cases
Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
• VBA Copy and Paste With Duplicates
Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
• Macro
is it possible for a macro to run if the active cell value is different to the value above it
• IF DATE and TIME
I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...