Excel formula for author names conversion - excel

does anyone know how to write TWO excel formulas that would change (A) and (B) respectively into (C)? I have hundreds of rolls of author names like (A) and (B). There are different numbers of author names in each string.
(A) Smith, John; Green, Yennis; Black, Eva; Brown, Robyn
(B) J. Smith; Y. Green. Black; R. Brown
(C) Smith J, Green Y, Black E & Brown R
(A) Smith, John; Green, Yennis
(B) J. Smith; Y. Green
(C) Smith J & Green Y
(A) Smith, John
(B) J. Smith
(C) Smith J

One way to approach this using formulas would be to split the data using the "Text to columns" on ";" delimiter. This will give 1 name per cell.
To convert "Smith, John" in cell A1 to "Smith J" you could use the formula
LEFT(REPLACE(A1,FIND(",",A1),1,""), FIND(" ",A1,1) )
To convert "J. Smith" in cell A1 to "Smith J" you could use the formula
MID(A1,FIND(".",A1) + 1, LEN(A1)-FIND(".", A1)) & " " & LEFT(A1,1)
Depending on how much the length varies, you could filter the data to remove empty cells and create formulas based on length.
B2 & ", " & D2 & " & " & E2 for 3 names, assuming you inserted a column to apply formulas to the right of each name. Or replace the cell reference with formulas if you don't want to insert columns.

Related

Find matches of 2 items in 2 different columns

Hello good afternoon community. I have an Excel question
I have this table
enter image description here
I can't find a way to determine which is the combination that is repeated the most but in both directions.
I mean, with the function count.si.set I can count how many Italy vs Portugal there were (12) but it doesn't give me how many Italy vs Portugal + Portugal vs Italy there were (14)
What is the step that I am missing?
You can use the greater than operator to check which word comes first alphabetically. Eg, IF(A1>A2,1,0) will return a 1 if the word in Cell A2 is alphabetically Earlier than the word in Cell A1.
Use this in the "Enfrentamientos" column with the following formula:
IF(A1 < B1, A1 & " " & " " B1, B1 & " " & A1)
This cells output will be the words in A1 and B1 concatenated in alphabetical order, so your Argentina & Germany pairs will come out the same as your Germany & Argentina Pairs.
Copy that formula down to the lower rows so it applies to each pair
Hope this helped!

Excel Find formula split string of names

I'm trying to split a list of names, They in the form of:
Surname, Title. Firstname (Nickname)
Jonesy, Mr. Cheese (Edam)
Bukowski, Mrs. Gertrude (Gerti)
I need to put them into Firstname Surname
It should be easy to pick up the Firstname: Two characters after the dot of Title up to the space before the left bracket of Nickname. Only my excel formula doesn't give me what I want.
A1 Smith, Mr. Andrew (Andy)
A2 =MID(A1,1,Find(" ",A1)-2)
A3 =MID(A1,Find(".",A1)+2, Find("(",A1)+1)
Only for A3 I get:
Andrew (Andy)
Instead of just the name Andrew
I'll add the caveat that I need the formula to refer to the name cell and not an cell with temp data to be referenced (ie an interim cell)
I can't see the woods for the trees on this one. Need to call in a bigger brain.
Assuming a data setup where headers are in row 1, with your "Complete Name" in column A starting in row 2, like so:
In cell B2 and copied down is this formula to get the first name:
=MID(A2,FIND(".",A2)+2,FIND("(",A2)-FIND(".",A2)-3)
In cell C2 and copied down is this formula to get the last name:
=LEFT(A2,FIND(",",A2)-1)
You can use this single formula to get the Firstname Surname:
=TRIM(MID(A1,SEARCH(".",A1)+1,SEARCH("(",A1)-SEARCH(".",A1)-1))&" "&MID(A1,1,FIND(" ",A1)-2)
Pretty Simple I think....(Famous last words).
You had:
A1 = Smith, Mr. Andrew (Andy)
A2 =MID(A1,1,Find(" ",A1)-2)
A3 =MID(A1,Find(".",A1)+2, Find("(",A1)+1)
I replaced the A# Find "(" with " " and it worked.
A1 = Smith, Mr. Andrew (Andy)
A2 =MID(A1,1,Find(" ",A1)-2)
A3 =MID(A1,Find(".",A1)+2, Find(" ",A1)+1)
This will only work if you have a single Firstname though. A name like Bobby Joe or Billy Bob will cut off at Bobby and Billy.

How to use vlookup if lookup value contains multiple values in single cell

Suppose Sheet1 has the following table ( data range Cell A1 to B4)
Fruits | Colors
======= | =======
Apple | Red
Mango | Green
Banana | Yellow
Suppose in sheet2, Cell A1 has following values ( Apple Mango Banana) separated based on space.
How to use VLookup in Cell B2 based on A1 value which can give you the results in the same order ( Red Green Yellow)
This formula in Sheet2!B2 does it:
=INDEX(sheet1!B:B,MATCH(TRIM(LEFT(SUBSTITUTE(A1, " ", REPT(" ", 100)),25)),sheet1!A:A,0)) & " " &
INDEX(sheet1!B:B,MATCH(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),100,25)),sheet1!A:A,0)) & " " &
INDEX(sheet1!B:B,MATCH(TRIM(RIGHT(SUBSTITUTE(A1, " ", REPT(" ", 100)),25)),sheet1!A:A,0))
This formula works fine when you have 3 values to match (in case there are 2 only, the second one will be repeated). It can be further complicated to treat any number of values.
Of course it can be simpler in VBA using the Split function, and it would take into account any number of keys, yielding the joined values. You can use this in a macro:
Sheet2.Range("B1").value = Join(Application.index(Sheet1.Columns("B"), _
Application.match(Split(Sheet2.Range("A1")), Sheet1.Columns("A"), 0)), " ")
Of course you can adjust it to any cell in column B, using Range("B" & i) and Range("A" & i)...

Check for string in text column A, return another string in column B - Excel

I am trying to lookup one of 3 strings (Blue, Red, Green) in column A. In column A I have:
row1: "Robert has Blue shorts"
row2: "Maria has a Red dress"
row3: "John has a Green car"
Whenever I find one of those 3 words in column A, I want to populate column B with the found instance (Green, Red, Blue).
There will always be one of these 3 words in column A, never more than one and the position of the words can be anywhere in the string.
I know how to put this in Python or SQL but I am struggling with Excel.
Can anyone share a solution if they used this in past?
You can use this array formula:
=INDEX({"Red","Blue","Green"},MATCH(TRUE,ISNUMBER(SEARCH({" Red "," Blue "," Green "}," " & A1 & " ")),0))
Being an array formula it must be confirmed with Ctrl-Shift-Enter when exiting edit mode. If done correctly then Excel will put {} around the formula.
As a note:
You can also replace the {"Red","Blue","Green"} with a range reference. So if the three words were in D1:D3 the formula would be:
=INDEX($D$1:$D$3,MATCH(TRUE,ISNUMBER(SEARCH(" " & $D$1:$D$3 & " "," " & A1 & " ")),0))

How do I combine the first character of a cell with another cell in Excel?

I have an Excel sheet with first names in Column A and surnames in Column B. I want to create a third Column C that contains the first character from the first name and adds it to the surname, creating first initial + surname.
First Name Last Name Combined Name
John Smith jsmith
How can I do this using Excel?
=CONCATENATE(LEFT(A1,1), B1)
Assuming A1 holds 1st names; B1 Last names
Personally I like the & function for this
Assuming that you are using cells A1 and A2 for John Smith
=left(a1,1) & b1
If you want to add text between, for example a period
=left(a1,1) & "." & b1
Use following formula:
=CONCATENATE(LOWER(MID(A1,1,1)),LOWER( B1))
for
Josh Smith = jsmith
note that A1 contains name and B1 contains surname
This is what formula I used in order to get the first letter of the first name and first letter of the last name from 2 different cells into one:
=CONCATENATE(LEFT(F10,1),LEFT(G10,1))
Lee Ackerman = LA
Not sure why no one is using semicolons. This is how it works for me:
=CONCATENATE(LEFT(A1;1); B1)
Solutions with comma produce an error in Excel.
QUESTION was: suppose T john is to be converted john T, how to change in excel?
If text "T john" is in cell A1
=CONCATENATE(RIGHT(A1,LEN(A1)-2)," ",LEFT(A1,1))
and with a nod to the & crowd
=RIGHT(A1,LEN(A1)-2)&" "&LEFT(A1,1)
takes the right part of the string excluding the first 2 characters, adds a space, adds the first character.

Resources