Re: how do i separate numbers and text in a cell?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



> > example a) Site: 3480 test data migration
> > example b) Home: Porterbrook / Ravers investigation (2 uur)
> > example c) Home: installation on Cognos (5.5 hrs)
> >
> > result a) should be 0 but prints 3480
> > result b) should prints 2 which is OK
> > result c) should prints 5.5 which is ok
> >
> biff, based on the formula i found my original description is > incorrect,
> sorry but i overlooked them cause of the number of records. on top of > the
> earlier given examples below the other exeptions.
>
>
> Example d) HOME upgrade laptop to pathc 08 (4hr)
> Example e) voorbereiden upload sheets training (is uiteindelijk niet
> doorgegaan)
> Example f) Helvoet aanmaken trainingsomgeving (CDE) 2 hr
> Example g) netwerk problemen ( 3 hr)
> Example h) WBGR - installation support (multi org)using email; 1 uur
> Example i) new years celebration (Lunch) 3 hrs
>
> Example j) 1) Nutricia Zoetermeer (migration to 8.2)
>
> Example k) 2) Siemens (prospect) RFP (request Bert)
> Example l) EMW shipment PRORDF modifications (DHA onsite) (1 uur)
>
> Result d) should print 4
> Result e) should print 0
> Result f) should print 2
> Result g) should print 3
> Result h) should print 1
> Result i) should print 3
> Result j) should print 0
> Result k) should print 0
> Result l) should print 1

Your new examples creates a problem in your specification that will need
clarifying. In examples (f) and (i), you say you want the 2 and 3... what
distinguishes (f) and (i) from (a) where you also had a number without
surrounding parentheses? Looking at example (j), it seems like it might be
because the numbers have descriptive text abbreviations after them. If that
is so, please tell us ALL of the abbreviations that will make a number one
of the numbers you want to retrieve. Another question... are the numbers you
want (the ones with the abbreviations after them) ALWAYS at the end of the
data line (or can other text, aside from the abbreviation) follow them?

1) Example a is just a number in the string, all number one numbers are
always at the end of the string, but not always between parentheses. I also
found situation with a space between the opening parentheses and the number.
2) Below are the formats I could expect. The abbreviations represent worked
hours in English and Dutch.

X hr
X hrs
X uur

Xhr
Xhrs
Xuur

x.x hr
x.x hrs
x.x uur

x.xhr
x.xhrs
x.xuur

hopes this answer the question?

I think this macro function will extract the numbers you are looking for...

Function ExtractNumber(ByVal StringIn As String) As Single
Dim Extraction() As String
On Error Resume Next
StringIn = Replace(StringIn, "(", "( ")
StringIn = Replace(StringIn, "hr", Chr$(1))
StringIn = Replace(StringIn, "uur", Chr$(1))
Extraction = Split(StringIn, Chr$(1))
Extraction = Split(RTrim$(Extraction(UBound(Extraction) - 1)), " ")
ExtractNumber = CSng(Extraction(UBound(Extraction)))
End Function


Rick

.



Relevant Pages

  • Re: how do i separate numbers and text in a cell?
    ... Biff, for now i would like to retreive the majority of the numbers. ... x.x hrs ... x.x uur ... because the numbers have descriptive text abbreviations after them. ...
    (microsoft.public.excel.misc)
  • Re: how do i separate numbers and text in a cell?
    ... always at the end of the string, but not always between parentheses. ... x.x hrs ... x.x uur ... because the numbers have descriptive text abbreviations after them. ...
    (microsoft.public.excel.misc)
  • Re: how do i separate numbers and text in a cell?
    ... found situation with a space between the opening parentheses and the number. ... x.x hrs ... x.x uur ... because the numbers have descriptive text abbreviations after them. ...
    (microsoft.public.excel.misc)
  • Re: how do i separate numbers and text in a cell?
    ... Example h) WBGR - installation support using email; 1 uur ... Example i) new years celebration 3 hrs ... please tell us ALL of the abbreviations that will make a number one of the numbers you want to retrieve. ...
    (microsoft.public.excel.misc)
  • Re: how do i separate numbers and text in a cell?
    ... installation on Cognos (5.5 hrs)" the number represents the number of ... be displayed as 5.5hr, or 5.5 uur. ... the only common part is that the data is ... ALWAYS at the right hand site of the text string ...
    (microsoft.public.excel.misc)