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.
[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.