Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All
I am trying to work out a macro that will extract the last two sentences in each cell of a range for summerizing. Each cell that I am working with contains from 1 to 10 sentences. I have been trying to figure this out with out any sucess. I hope that someone out there might have a idea on how to do this. Thanks in advance Troy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What is the pattern that defines the break? Line Feed, Period?
Die_Another_Day Viking wrote: Hello All I am trying to work out a macro that will extract the last two sentences in each cell of a range for summerizing. Each cell that I am working with contains from 1 to 10 sentences. I have been trying to figure this out with out any sucess. I hope that someone out there might have a idea on how to do this. Thanks in advance Troy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Troy,
Assumes sentences end with a dot - Option Explicit Function TwoSentences(sIn As String) As String Dim sa Dim sOut As String Dim u As Long On Error GoTo errH sa = Split(sIn, ".") 'n/a XL97 If IsArray(sa) Then u = UBound(sa) If u 0 Then If Len(sa(u)) = 0 Then u = u - 1 If Len(sa(u)) Then sOut = sa(u) & "." End If If u 0 Then If Len(sa(u - 1)) Then sOut = sa(u - 1) & "." & sOut End If Else: sOut = sIn End If End If TwoSentences = Trim(sOut) Exit Function errH: TwoSentences = CVErr(xlErrValue) End Function Regards, Peter T "Viking" wrote in message oups.com... Hello All I am trying to work out a macro that will extract the last two sentences in each cell of a range for summerizing. Each cell that I am working with contains from 1 to 10 sentences. I have been trying to figure this out with out any sucess. I hope that someone out there might have a idea on how to do this. Thanks in advance Troy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extraction | Excel Worksheet Functions | |||
Sentence Case | Excel Discussion (Misc queries) | |||
Extraction | Excel Discussion (Misc queries) | |||
extraction | Excel Discussion (Misc queries) | |||
Extraction | Excel Worksheet Functions |