Equation to output 'agent name' "Copy" or "Not Found"

oprik

New Member
Joined
Jan 24, 2018
Messages
8
[TABLE="width: 480"]
<colgroup><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Hello,[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 6"]I had an excel test that I didn't do particularly well on, but this one question had me stumped.[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]I need an equation that takes the name in this list and out puts the agent name in 'first.initial' or "COPY" or "NOT FOUND"[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sheet 1:[/TD]
[TD][/TD]
[TD="colspan: 2"]Convert these names:[/TD]
[TD="colspan: 2"]Correct output:[/TD]
[/TR]
[TR]
[TD]Agent [/TD]
[TD][/TD]
[TD]David Everit[/TD]
[TD][/TD]
[TD]David.e[/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD]Joe a.[/TD]
[TD][/TD]
[TD]Joe.A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Adam.m[/TD]
[TD][/TD]
[TD]Ben[/TD]
[TD][/TD]
[TD]Ben.B[/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD]Sam p.[/TD]
[TD][/TD]
[TD]NOT FOUND[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Agent [/TD]
[TD][/TD]
[TD]Training 22[/TD]
[TD][/TD]
[TD]Training.22[/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD]David E.[/TD]
[TD][/TD]
[TD]COPY[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]David.e[/TD]
[TD][/TD]
[TD]Kat Cathy[/TD]
[TD][/TD]
[TD]Kat.C[/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD]David D.[/TD]
[TD][/TD]
[TD]NOT FOUND[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Agent [/TD]
[TD][/TD]
[TD]Adam.S[/TD]
[TD][/TD]
[TD]NOT FOUND[/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Joe.A [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Agent[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Ben.B[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Agent[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Kat.C[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Agent[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Training.22[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Agent[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Admin[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Agent[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Training.22[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 6"]The equation i submitted that my teacher said was wrong was:[/TD]
[/TR]
</tbody>[/TABLE]
=IFNA(IF(COUNTIF(Sheet1!A:A, A3)>1, "Duplicate", INDEX(Sheet1!A:A,MATCH(A3&"*",Sheet1!A:A,0))),"Not Found")[/QUOTE]
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Your main problem is that you were required to convert the name into a standard format before doing the analysis. Assuming this data is pasted in columns A and B of the same worksheet you'd start with something like [=LEFT(B2,FIND(" ",B2)-1)&"."&MID(B2,FIND(" ",B2)+1,1)] to get the name. Then you'd need to check if that same name had been found already, then wrap the whole thing in an error handler to get the "not found". Easier in multiple steps, but to do it all in one formula is a bit nasty and unnecessary!
 
Upvote 0
Your main problem is that you were required to convert the name into a standard format before doing the analysis. Assuming this data is pasted in columns A and B of the same worksheet you'd start with something like [=LEFT(B2,FIND(" ",B2)-1)&"."&MID(B2,FIND(" ",B2)+1,1)] to get the name. Then you'd need to check if that same name had been found already, then wrap the whole thing in an error handler to get the "not found". Easier in multiple steps, but to do it all in one formula is a bit nasty and unnecessary!

I thought about doing that but that equation only works if you are given both the first and last name of the agent, so in the example it would work for David Everit to make David.E but not for Ben. I also found that the equation INDEX(Sheet1!A:A,MATCH(LEFT(A9,5)&"*",Sheet1!A:A,0)) worked for some of the Agents but not all. Nasty and unnecessary is what i thought too, I could think of a way to do this in three columns but not all in one
 
Upvote 0
In C2, copied down:
=IF(ISERROR(LEFT(B2,FIND(" ",B2)-1)&"."&MID(B2,FIND(" ",B2)+1,1)),"not found",IF(COUNTIF($C$1:C1,LEFT(B2,FIND(" ",B2)-1)&"."&MID(B2,FIND(" ",B2)+1,1))>0,"duplicated",LEFT(B2,FIND(" ",B2)-1)&"."&MID(B2,FIND(" ",B2)+1,1)))

This is an awkward formula to read but was constructed in 3 separate columns and then merged together, which made it easier to create. My 3 construction formulas were E2:G2 as follows:
=LEFT(B2,FIND(" ",B2)-1)&"."&MID(B2,FIND(" ",B2)+1,1)
=COUNTIF($E$1:E1,E2)>0
=IF(ISERROR(E2),"not found",IF(COUNTIF($E$1:E1,E2)>0,"duplicated",E2))


Being pedantic, Ben should fail because there's not enough info to create first.initial
 
Upvote 0
And it turns out I got it wrong too, as I forgot to check the name against the original list using MATCH and confirm it was actually there. Oh well, you get the gist...:laugh:
 
Upvote 0
Thank you, You've given me some great ideas on how to do this, but you keep referencing the 'Convert these names:' list as apposed to searching the 'Sheet1'. I think what i'll do is some kind of index/match function using your Left( ,FIND()) & MID( ,FIND)) combination to see if i can get the equation to also search for single named agents like Ben to have it comeback with Ben.B
 
Upvote 0
And it turns out I got it wrong too, as I forgot to check the name against the original list using MATCH and confirm it was actually there. Oh well, you get the gist...:laugh:

The correct answer the Teacher was looking for was:
=IF(SUMPRODUCT(LEN(Sheet1!A:A)-LEN(SUBSTITUTE(LOWER(CALLER!A:A),LOWER('Sheet2'!A3),"")))/LEN('Sheet2'!A3)>1,"COPY",IFERROR(INDEX(Sheet1!A:A,MATCH(IFERROR(SUBSTITUTE(LEFT(A3,FIND(" ",A3,1)-1)&"."&MID(A3,FIND(" ",A3,1),2)," ",""),A3)&"*",Sheet1!A:A,0)),"Not Found"))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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