Count occurrence of unknown text strings

mkl1

New Member
Joined
May 30, 2012
Messages
14
Office Version
  1. 365
HI I am looking to prepare an analysis of text occurrence where the text is not known upfront.

So essentially it will spot, find and report the occurrence that were not there in the previous report - they change with each result set.

So for instance if the first report had:

AAAB1
AAAB1
AAAB2
AAAB3

Then the second report had
AAAB1
AAAB2
AAAC1
AAAB2
AAAB3

I want the analysis to tell me what appeared and how many times - without my having to tell it up front which codes will appear. Is there a way to do that?

Many thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Are those two reports in the same workbook?, Are they on the same worksheet?

What are the expected results for that sample data and please give any further clarification that you can about those expected results.

Does it matter whether any suggested solution uses formulas/vba/power query?
 
Upvote 0
If you have 365:
MrExcelPlayground2.xlsx
ABCD
1Report 1Report 2New Item - Count
2AAAB1AAAB1AAAC1-2
3AAAB1AAAB2AAAB4-1
4AAAB2AAAC1
5AAAB3AAAB2
6AAAB3
7AAAC1
8AAAB4
Sheet26
Cell Formulas
RangeFormula
D2:D3D2=FILTER(UNIQUE(B2:B8)&"-"&IF(COUNTIF($A$2:$A$5,UNIQUE(B2:B8))=0,COUNTIF($B$2:$B$8,UNIQUE(B2:B8)),""),IF(COUNTIF($A$2:$A$5,UNIQUE(B2:B8))=0,COUNTIF($B$2:$B$8,UNIQUE(B2:B8)),"")<>"","")
Dynamic array formulas.
 
Upvote 0
If you have 365:
MrExcelPlayground2.xlsx
ABCD
1Report 1Report 2New Item - Count
2AAAB1AAAB1AAAC1-2
3AAAB1AAAB2AAAB4-1
4AAAB2AAAC1
5AAAB3AAAB2
6AAAB3
7AAAC1
8AAAB4
Sheet26
Cell Formulas
RangeFormula
D2:D3D2=FILTER(UNIQUE(B2:B8)&"-"&IF(COUNTIF($A$2:$A$5,UNIQUE(B2:B8))=0,COUNTIF($B$2:$B$8,UNIQUE(B2:B8)),""),IF(COUNTIF($A$2:$A$5,UNIQUE(B2:B8))=0,COUNTIF($B$2:$B$8,UNIQUE(B2:B8)),"")<>"","")
Dynamic array formulas.
This is great - solved the issue! Thanks a lot!
 
Upvote 0
An alternative solution is to bring each table into Power Query and then run a right anti merge. Here is the Mcode

Power Query:
let
    Source = Table.NestedJoin(Table1, {"Report 1"}, Table2, {"Report 2"}, "Table2", JoinKind.RightAnti),
    #"Expanded Table2" = Table.ExpandTableColumn(Source, "Table2", {"Report 2"}, {"Table2.Report 2"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Table2",{"Report 1"}),
    #"Grouped Rows" = Table.Group(#"Removed Columns", {"Table2.Report 2"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"

Book3
AB
1Table2.Report 2Count
2AAAC12
3AAAB41
Merge1


Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0
Thanks for updating your profile. (y)

What about two fairly simple formulas like this?

21 05 24.xlsm
ABCDE
1Report 1Report 2New ItemsCount
2AAAB1AAAB1AAAC12
3AAAB1AAAB2AAAB41
4AAAB2AAAC1
5AAAB3AAAB2
6AAAB3
7AAAC1
8AAAB4
9
New
Cell Formulas
RangeFormula
D2:D3D2=UNIQUE(FILTER(B2:B8,ISNA(MATCH(B2:B8,A2:A5,0)),""))
E2:E3E2=COUNTIF(B2:B8,D2#)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,286
Members
449,076
Latest member
kenyanscott

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