#1




Formula to extract last two letters from each word
Hello, I have a cell that has a list of years (example 1999 2000 2001 2002 2003 2004) and I need a formula to change this example into (99 00 01 02 03 04). There may be anywhere from one year up to 20 years in this cell. I found this
Code:
=LEFT(A1,1)&MID(A1,FIND(" ",A1&" ",1)+1,1)&MID(A1&" ",FIND(" ",A1&" ",FIND(" ",A1&" ",1)+1)+1,1) 
#2




Formula to extract last two letters from each word
See cell B1 in the attached.
As you can see the solution requires helper cells (as C1:V1). If you so wish these can be moved to somewhere out of sight. Edit: Only now I see that you use Office 2010 so I guess you can't use above solution as it requires the function TEXTJOIN which is only available in the most recent version of Excel. 
#3




Hello, I appreciate you taking the time to help here. It did get me thinking in another direction through. Maybe if I extract each year into its own cell, trim the first two numbers off each and put these new values back together. Might it be better to modify the formula in my original post to extract the last 2 numbers and string out the capacity to do up to 20 words. I have tried this but I don't have enough understanding of the formula to do this. Just a note: each original number will always have 4 characters and they will always be numbers. Thanks again..

#4




If you can live with an xlsm file,
how about a User Defined Function (UDF) ? Code:
Public Function LastTwo(Orig As String) As String Dim i As Long, arr arr = Split(Orig, " ") For i = LBound(arr) To UBound(arr) LastTwo = Trim(LastTwo & " " & Right(arr(i), 2)) Next i End Function 
#5




Quote:
And to put the results together you would have something like =A1&" "&A2&" ".... The UDF NoS provided would be easier ( haven't tested it but I suppose he/she did )
__________________
Problem solved ? Let others know by clicking " Thread Tools" then " Mark thread as solved".( This can be undone if need be) Want to thank for the help received ? Click the scales symbol in the upper right corner of a post from the person you want to thank. 
#6




Formula to extract last two letters from each word
I think NoSparks solution is unbeatable
If however you prefer no VBA you might be interested in the attached. 
#7




Worked like a charm. Already using xlsm so this fit right in and this is so simple. Maybe "simple" is the wrong word because I can't figure out how it works. Very short and compact. It's something else I can study when I get caught up here. Many Thanks..

#8




@ xor
I'm no good with formulas, but I think you need to revisit populating C1 to V1 as it misses the second year shown in A1 
#9




@NoSparks
... populating C1 to V1 as it misses the second year shown in A1 .... You are right. ´ The formula in C1 should just be copied to D1:V1 and it works. I don't know what has happened. Last edited by xor; 04072019 at 01:44 AM. 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Formula to Extract text from a text string  Haha88  Excel  2  11142017 01:32 AM 
How to assign numbers to letters and then create a formula to add them together for a rota  Mskapri  Excel  6  04012017 03:05 PM 
I'm looking for a formula to extract all the text before the last name in a cell  Gef  Excel  4  02012015 07:14 PM 
Word not 'rounding' letters up to word in next line (parents and orphans)  Asa  Word  4  09132014 06:47 PM 
extract text with formula  s7y  Excel  7  06052013 06:18 AM 