Counting duplicates and assigning a tag

Msdtitus

New Member
Joined
Aug 31, 2010
Messages
38
Office Version
  1. 365
Platform
  1. Windows
I am looking for a formula which can assign a code based on predefined criteria
[TABLE="width: 0, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Strategy[/TD]
[TD]Name[/TD]
[TD]Area[/TD]
[TD]Calls[/TD]
[TD]Priority[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]S1[/TD]
[TD]Amy[/TD]
[TD]Bakery[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]S2[/TD]
[TD]Jane[/TD]
[TD]Bakery[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]S3[/TD]
[TD]Jane[/TD]
[TD]Bakery[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]S1[/TD]
[TD]Amy[/TD]
[TD]Bakery[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]S1[/TD]
[TD]Peter[/TD]
[TD]Bakery[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]S3[/TD]
[TD]Peter[/TD]
[TD]Bakery[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]S2[/TD]
[TD]Jane[/TD]
[TD]Bakery[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]S2[/TD]
[TD]Amy[/TD]
[TD]Bakery[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]S1[/TD]
[TD]Jane[/TD]
[TD]Bakery[/TD]
[TD]1[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Part 1
The formula must look at how many calls was assessed for each person

What I need is a formula that looks at only the first 2 entries of a person(Amy) which should be given priority 1, and the balance to be given the priority 3 tag

Because Jane has 1 call already, only 1 call must be given the P2 code and the rest get a P3 code

in the event that a person has 2 or more calls, then they will automatically receive a P3 code

so ideally it should look like this when the code runs
[TABLE="width: 0, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Strategy[/TD]
[TD]Name[/TD]
[TD]Area[/TD]
[TD]Calls[/TD]
[TD]Priority[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]S1[/TD]
[TD]Amy[/TD]
[TD]Bakery[/TD]
[TD]0[/TD]
[TD]P1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]S3[/TD]
[TD]Jane[/TD]
[TD]Bakery[/TD]
[TD]1[/TD]
[TD]P2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]S3[/TD]
[TD]Jane[/TD]
[TD]Bakery[/TD]
[TD]1[/TD]
[TD]P3[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]S3[/TD]
[TD]Amy[/TD]
[TD]Bakery[/TD]
[TD]0[/TD]
[TD]P3[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]S1[/TD]
[TD]Peter[/TD]
[TD]Bakery[/TD]
[TD]5[/TD]
[TD]P3[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]S3[/TD]
[TD]Jake[/TD]
[TD]Bakery[/TD]
[TD]2[/TD]
[TD]P3[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]S2[/TD]
[TD]Jane[/TD]
[TD]Bakery[/TD]
[TD]1[/TD]
[TD]P3[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]S2[/TD]
[TD]Amy[/TD]
[TD]Bakery[/TD]
[TD]0[/TD]
[TD]P1[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]S3[/TD]
[TD]Jane[/TD]
[TD]Bakery[/TD]
[TD]1[/TD]
[TD]P3[/TD]
[/TR]
</tbody>[/TABLE]



Part 2
The above formula should also assign these codes based on the preferred strategy

As illustrated above, Amy has calls with the S1,S2 and S3 codes respectively and the Formula will look for the first look for a qualifying S1 it can find and assign them the P1 code, then S2 and if none exist, S3

For Jane, the best Strategy is S2 so that will receive the P2 code and the rest will receive P3 codes

I'm not sure if this is clear enough but this is a really complex piece of work.
 

Excel Facts

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

is anyone able to assist me with the above request?
 
Upvote 0
Good Morning Guys

I would really like some assistance on this as I am trying all sorts of formulas but none seems to be working

I tried the following formula but this seems to be giving me half of what I need in that it flags the 1st instance of the duplicate but everything else gets the same Flag. See the formula below

=IF(COUNTIF($A$2:A2,A2)>2,"P3",IF(COUNTIF($A$2:A2,A2)=1,"P1","P2"))

Any assistance will be really valued

many thanks
Masood
 
Last edited:
Upvote 0
Good Morning all

i have still not been able to find a solution so if there is anyone on the Forum that may be able to assist i will geatly appreciate it
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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