Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extract date from right to left in a cell
I have an excel spreadsheet containing numerous cells. I need to
extract the right most word in each cell. The lengths and number of spaces vary between cells, so I need a function that will read from right to left until a space is encountered. Any help will be greatly appreciated. J |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extract date from right to left in a cell
J Bob Umlas seems to have this answered very well a http://www.emailoffice.com/excel/arrays-bobumlas.html. Hope it helps -- Kiera Born ignorant and still perfecting the ar ----------------------------------------------------------------------- Kieran's Profile: http://www.excelforum.com/member.php...nfo&userid=124 View this thread: http://www.excelforum.com/showthread.php?threadid=27407 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extract date from right to left in a cell
if you have excel 2000, use InstrRev
iloc = InstrRev(cell.Value," ") lastword = right(cell.Value,Len(cell.value)-iloc) -- Regards, "jh" wrote in message om... I have an excel spreadsheet containing numerous cells. I need to extract the right most word in each cell. The lengths and number of spaces vary between cells, so I need a function that will read from right to left until a space is encountered. Any help will be greatly appreciated. J |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extract date from right to left in a cell
Hi JH,
Try: Sub Tester() Dim sStr As String, oldStr As String Dim iPos As Long Dim Rng As Range, Rng2 As Range, rCell As Range Set Rng = Range("A1:A100") '<<=== CHANGE On Error Resume Next Set Rng2 = Rng.SpecialCells(xlCellTypeConstants, _ xlTextValues) On Error GoTo 0 If Not Rng2 Is Nothing Then For Each rCell In Rng2 oldStr = rCell.Text iPos = InStrRev(oldStr, " ") sStr = Mid(oldStr, iPos + 1) MsgBox sStr Next rCell End If End Sub Change Rng = Range("A1:A100") to suit your needs. --- Regards, Norman "jh" wrote in message om... I have an excel spreadsheet containing numerous cells. I need to extract the right most word in each cell. The lengths and number of spaces vary between cells, so I need a function that will read from right to left until a space is encountered. Any help will be greatly appreciated. J |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extract date from right to left in a cell
Looks like there's already some answers here, but I'll throw mine out there
for you also (paste into a module and use it as a function in the workbook): Function RIGHTWORD(rng As Range) If rng.Cells.Count 1 Then RIGHTWORD = CVErr(xlErrValue) If IsEmpty(rng.Value) Then RIGHTWORD = "" RIGHTWORD = Right(rng.Value, Len(rng.Value) - InStrRev(rng.Value, " ")) End Function -erik "jh" wrote in message om... I have an excel spreadsheet containing numerous cells. I need to extract the right most word in each cell. The lengths and number of spaces vary between cells, so I need a function that will read from right to left until a space is encountered. Any help will be greatly appreciated. J |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Extract date from right to left in a cell
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Extract Text with Left, Mid, etc | Excel Worksheet Functions | |||
Easiest way to extract characters in a cell LEFT or RIGHT of a sym | Excel Worksheet Functions | |||
extract name when a date in another cell gets near | Excel Worksheet Functions | |||
extract name when a date in another cell gets near | Excel Discussion (Misc queries) | |||
Extract date from cell | Excel Worksheet Functions |