Excel Function to Extract Text String, Remove Duplicate & Count

arijitirf

Board Regular
Joined
Aug 11, 2016
Messages
118
Office Version
  1. 2016
Platform
  1. Windows
Hi!
My excel sheet has two column having data like the enclosed image;

I need end result by showing count of unique item against each name in Col B.

First, formula will extract text string before number by removing "-" like below

Prime Incorporation
Swiss Automation
MSTS - TRS Corp.
Prime Incorporation
MSTS - TRS Corp.

Then it will remove the duplicate and return below;

Prime Incorporation
Swiss Automation
MSTS - TRS Corp.

Post that it will give us count against name like below:

Rajib: 2
Pulok: 1

Is that possible using Excel Function.

Required urgent help.
 

Attachments

  • Screenshot_2024-09-12-01-27-22-11_c37d74246d9c81aa0bb824b57eaf7062.jpg
    Screenshot_2024-09-12-01-27-22-11_c37d74246d9c81aa0bb824b57eaf7062.jpg
    204.6 KB · Views: 13

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi!
My excel sheet has two column having data like the enclosed image;

I need end result by showing count of unique item against each name in Col B.

First, formula will extract text string before number by removing "-" like below

Prime Incorporation
Swiss Automation
MSTS - TRS Corp.
Prime Incorporation
MSTS - TRS Corp.

Then it will remove the duplicate and return below;

Prime Incorporation
Swiss Automation
MSTS - TRS Corp.

Post that it will give us count against name like below:

Rajib: 2
Pulok: 1

Is that possible using Excel Function.

Required urgent help.
Are you still using Excel 2016?
 
Upvote 0
Good to hear you got the solution.
If you would like to post the solution then it is perfectly fine to mark your post as the solution to help future readers. Otherwise, please do not mark a post that doesn't contain a solution.
 
Upvote 0
Thank you Fluff for correcting me.

I am delighted to post the solution here to help others on the subject mentioned topic.

Basically, I need count of Unique Company Name as mentioned in Column B against each Name as per Column C. Let assume I have narration Data in Range "B1:B200" and Name in Range "C1:C200". However, there are 7 Unique Names can be obtained if deduplication is executed between "C1:C200"

For the Unique Name to be filtered out from Column A, need a Function to extract data from left till the Numerics (Like if the narration is "Prime Incorporation - 2345 - Lunch" then the output will be "Prime Incorporation")

Function that has been used in the above scenario is appended below;

First Step (to find the Position of the Numeric String inside the Narration):
Using below function to determine the position of first number in the numeric string. Here "B1" is referred to the narration i.e. "Prime Incorporation - 2345 - Lunch"

Assume below Function is written at "D1"
Excel Formula:
=MIN(FIND({0,1,2,3,4,5,6,7,8,9},B1&"0123456789"))

Output will be generated as 23 at "D1"as the number starts at Position 23 from Left.

Next Step (to Extract Text String from Left removing the extra Space & "-" used in between Text and Number):
Now, using below Function to extract text before numeric i.e. "Prime Incorporation"

Assume below Function is written at "E1"
Excel Formula:
=IFERROR(LEFT(B1,D1-3),"")

Output will be generated as "Prime Incorporation" at "E1". Here in the above Function "B1" is referred to the narration i.e. "Prime Incorporation - 2345 - Lunch" and "D1" is referred to the position i.e. "23" and "-3" is used not to show the extra space & "-" used between Text String and Number String inside the narration.

Next Step (to Remove Duplicate Narration Extract and Count against each Name):

Now, as the last part of the entire process, below Function is used to Count Unique Text String at "E1" against Name at Column "C" assuming you have Output Data in Range "E1:E200" and count against at "J1"

Assuming below Function is written at "K1"
Excel Formula:
=SUM(--(LEN(UNIQUE(FILTER($E$1:$E$200,($C$1:$C$200=J1),"")))>0))

Output will be generated basis the unique count in Range "E1:E200" against the Name in "J1". Dragging the Function against the 7 Unique Name at "J1:J7" can give Unique Count as per the Output in Range "E1:E200" basis date in the concerned Range i.e. "J1:J7"

Hope this may help future readers or candidate having query on the similar topic.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,173
Members
452,615
Latest member
bogeys2birdies

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