Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have been using the following formula to pick out the 1st letter of words.
=CONCATENATE(LEFT(A2,1),MID(A2,FIND(" ",A2)+1,1)) This has been working fine until there are 3 words in the cell. I would like to be able to pick out the 1st letter of each word in the cell no matter how many letters there are. Or to be able to pick out the 1st letter of the first and last words only. Words I am using a Project Manager Ongoing Specialist Support Monitoring and Evaluation I would like the adjacent cells to show: PM OSS ME Is this possible without going down the route of coding? Many thanks for your time. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Note that your examples are inconsistent.
Ongoing Specialist Support == OSS Monitoring and Evaluation == ME FIrst and last is easy: =LEFT(A2,1) & MID(A2, FIND("%",SUBSTITUTE(A2," ","%", LEN(A2) - LEN(SUBSTITUTE(A2," ",""))))+1,1) In article , DianeandChipps wrote: I have been using the following formula to pick out the 1st letter of words. =CONCATENATE(LEFT(A2,1),MID(A2,FIND(" ",A2)+1,1)) This has been working fine until there are 3 words in the cell. I would like to be able to pick out the 1st letter of each word in the cell no matter how many letters there are. Or to be able to pick out the 1st letter of the first and last words only. Words I am using a Project Manager Ongoing Specialist Support Monitoring and Evaluation I would like the adjacent cells to show: PM OSS ME Is this possible without going down the route of coding? Many thanks for your time. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Two or three is easy too:
=LEFT(A2,1) & MID(A2,FIND(" ",A2)+1,1)&IF(LEN(A2)-LEN(SUBSTITUTE(A2," ", ""))1, MID(A2,FIND(" ",A2,FIND(" ",A2)+1)+1,1),"") but it will produce "MaE", not "ME" In article , JE McGimpsey wrote: Note that your examples are inconsistent. Ongoing Specialist Support == OSS Monitoring and Evaluation == ME FIrst and last is easy: =LEFT(A2,1) & MID(A2, FIND("%",SUBSTITUTE(A2," ","%", LEN(A2) - LEN(SUBSTITUTE(A2," ",""))))+1,1) |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
=CONCATENATE(LEFT(A2,1),MID(A2,FIND(" ",A2)+1,1))
First off, for future reference, you don't need to use the CONCATENATE function to concatenate text together... you can simply join the strings together with ampersands. Also, if looking for the first character in a LEFT (or RIGHT) function, you don't need to specify the character count... if you leave out the 2nd argument, Excel automatically assumes 1 character. So then, the above is identical to this... =LEFT(A2)&MID(A2,FIND(" ",A2)+1,1) Now, to answer your main question... you could probably construct a formula to do what you want (up to a limit of 30 words I would guess), but the logic will get messy if you have to skip over lower case leading letters (such as your "and"). I may look at doing a formula later, but in the meantime, here is a UDF (User Defined Function) which will do what you want for an unlimited number of words... Function FirstLetters(S As String) As String Dim X As Long Dim Letter As String Dim Words() As String Words = Split(S) For X = 0 To UBound(Words) Letter = Left(Words(X), 1) If Letter = UCase(Letter) Then FirstLetters = FirstLetters & Letter Next End Function If you are unfamiliar with how to install a UDF, it is quite simple. Press Alt+F11 to go into the VB editor, click Insert/Module on its menu bar and copy/paste the above UDF into the code window that appears. That is it. Go back to your worksheet and enter this formula... =FirstLetters(A2) and copy it down as needed (you can copy it past your last data if desired). -- Rick (MVP - Excel) "DianeandChipps" wrote in message ... I have been using the following formula to pick out the 1st letter of words. =CONCATENATE(LEFT(A2,1),MID(A2,FIND(" ",A2)+1,1)) This has been working fine until there are 3 words in the cell. I would like to be able to pick out the 1st letter of each word in the cell no matter how many letters there are. Or to be able to pick out the 1st letter of the first and last words only. Words I am using a Project Manager Ongoing Specialist Support Monitoring and Evaluation I would like the adjacent cells to show: PM OSS ME Is this possible without going down the route of coding? Many thanks for your time. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Thu, 5 Feb 2009 07:32:30 -0800, DianeandChipps
wrote: I have been using the following formula to pick out the 1st letter of words. =CONCATENATE(LEFT(A2,1),MID(A2,FIND(" ",A2)+1,1)) This has been working fine until there are 3 words in the cell. I would like to be able to pick out the 1st letter of each word in the cell no matter how many letters there are. Or to be able to pick out the 1st letter of the first and last words only. Is this possible without going down the route of coding? I think *any* number of letters would be difficult without code. However, you can brute force four letters with this formula =LEFT(A1,1)&IF(NOT(ISERR(FIND(" ",A1,1))),MID(A1,FIND(" ",A1,1)+1,1),"")&IF(NOT(ISERR(FIND(" ",A1,FIND(" ",A1,1)+1))),MID(A1,FIND(" ",A1,FIND(" ",A1,1)+1)+1,1),"")&IF(NOT(ISERR(FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,1)+1)+1)))),MID(A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,FIND(" ",A1,1)+1)+1))+1,1),"") -- Dick Kusleika Microsoft MVP-Excel http://www.dailydoseofexcel.com |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks to all that responded, sorry I haven't replied before now as I
have had sight problems. All suggestions work picking out the first letter of each word. I even managed Ricks UDF and it ignored the lower case 'and'. Many thanks again Diane "DianeandChipps" wrote: I have been using the following formula to pick out the 1st letter of words. =CONCATENATE(LEFT(A2,1),MID(A2,FIND(" ",A2)+1,1)) This has been working fine until there are 3 words in the cell. I would like to be able to pick out the 1st letter of each word in the cell no matter how many letters there are. Or to be able to pick out the 1st letter of the first and last words only. Words I am using a Project Manager Ongoing Specialist Support Monitoring and Evaluation I would like the adjacent cells to show: PM OSS ME Is this possible without going down the route of coding? Many thanks for your time. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I include names in formula by picking up names from rows | Excel Worksheet Functions | |||
Picking names from a hat in Excel? | Excel Discussion (Misc queries) | |||
how to put 'SUM' formula in VB after picking up certain names and their bonus | Excel Discussion (Misc queries) | |||
how do i sort a list from cells by picking a specific letter? | Excel Discussion (Misc queries) | |||
FIRST letter of the names, mi and the whole last name. | Excel Discussion (Misc queries) |