Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Sentence extraction

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Sentence extraction

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Sentence extraction

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extraction Donna[_2_] Excel Worksheet Functions 12 October 29th 09 04:24 AM
Sentence Case Alex Excel Discussion (Misc queries) 2 August 21st 08 09:45 PM
Extraction Pascale Excel Discussion (Misc queries) 2 January 18th 08 04:45 PM
extraction oldLearner57 Excel Discussion (Misc queries) 2 November 19th 07 01:09 PM
Extraction Martina Excel Worksheet Functions 4 May 24th 07 04:48 AM


All times are GMT +1. The time now is 03:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"