Hi, Nebu helped me with a formula two years ago which we use extensively. It puts surnames and first names in a configuration that I use to sort names in a data base. But it has always had a bug. For two years I corrected it manually but our database of names is now larger and requires many manual corrections. I am wondering if Nebu is still around or if anyone else can fix the formula. It is too complicated for me.
What it does is:
Column A is called Name. It contains the surnames eg Smith
Column B is called First name and it has the husband and wife’s first names. It can be written as Bill and Gwen or Bill & Gwen. If there is one person it can be written Bill &
There are other contact details in the other columns and Colum K expresses the formula that Nebu gave me. The formula returns the surname with the first letters of the first names. It gives say, AdamD&A or if a single person AdamD&. I use this to then do a name search to pull out all their details automatically.
It works very well except if the name has the word “and” in it it fails. For instance if the surname is Bourne and the first names are Peter and Sandra it will return P&a (should return P&S) because Sandra has “and” in the name
Or if the surname is Butlin, Andrew and Janet it returns Butlin A&e. It should return A&. This is because Andrew has “and” in his first name.
This is the formula
=IFERROR(IF(ISNUMBER(SEARCH("and",B2,1)),A2&LEFT(B2,1)&"&"&MID(B2,SEARCH("and",B2,1)+4,1),A2&LEFT(B2,1)&"&"&MID(B2,SEARCH("&",B2,1)+2,1)),A2&LEFT(B2,1)&"&")
Thanks your help is appreciated
MalR
What it does is:
Column A is called Name. It contains the surnames eg Smith
Column B is called First name and it has the husband and wife’s first names. It can be written as Bill and Gwen or Bill & Gwen. If there is one person it can be written Bill &
There are other contact details in the other columns and Colum K expresses the formula that Nebu gave me. The formula returns the surname with the first letters of the first names. It gives say, AdamD&A or if a single person AdamD&. I use this to then do a name search to pull out all their details automatically.
It works very well except if the name has the word “and” in it it fails. For instance if the surname is Bourne and the first names are Peter and Sandra it will return P&a (should return P&S) because Sandra has “and” in the name
Or if the surname is Butlin, Andrew and Janet it returns Butlin A&e. It should return A&. This is because Andrew has “and” in his first name.
This is the formula
=IFERROR(IF(ISNUMBER(SEARCH("and",B2,1)),A2&LEFT(B2,1)&"&"&MID(B2,SEARCH("and",B2,1)+4,1),A2&LEFT(B2,1)&"&"&MID(B2,SEARCH("&",B2,1)+2,1)),A2&LEFT(B2,1)&"&")
Thanks your help is appreciated
MalR