Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Todd
 
Posts: n/a
Default remove text from string

I have a set of numbers with text in them and I need to remove the text.

32h
320h
4206h

The H is always last but has different numbers of digits before it. Its a
column of data I need to group and sum. The data comes from a query and is
refreshed frequently so the "h" has to be removed every time the query
refreshes. I planned to put a formula in a column right beside the query
data but can't figure out how to write the formula because the H has
different numbers of digits before it.

How can I do this?


Todd

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Elkar
 
Posts: n/a
Default remove text from string

Try this:

=LEFT(A1,LEN(A1)-1)

HTH,
Elkar


"Todd" wrote:

I have a set of numbers with text in them and I need to remove the text.

32h
320h
4206h

The H is always last but has different numbers of digits before it. Its a
column of data I need to group and sum. The data comes from a query and is
refreshed frequently so the "h" has to be removed every time the query
refreshes. I planned to put a formula in a column right beside the query
data but can't figure out how to write the formula because the H has
different numbers of digits before it.

How can I do this?


Todd

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave
 
Posts: n/a
Default remove text from string

I you need to sum the numbers after you get rid of the text I would suggest
using

=VALUE(LEFT(A1,LEN(A1)-1))

"Elkar" wrote:

Try this:

=LEFT(A1,LEN(A1)-1)

HTH,
Elkar


"Todd" wrote:

I have a set of numbers with text in them and I need to remove the text.

32h
320h
4206h

The H is always last but has different numbers of digits before it. Its a
column of data I need to group and sum. The data comes from a query and is
refreshed frequently so the "h" has to be removed every time the query
refreshes. I planned to put a formula in a column right beside the query
data but can't figure out how to write the formula because the H has
different numbers of digits before it.

How can I do this?


Todd

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Marcelo
 
Posts: n/a
Default remove text from string

Todd, you could also use this VBA Function,

Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object

Set oRegExp = CreateObject("VBScript.RegExp")

With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"

DigitsOnly = oRegExp.Replace(sStr, vbNullString)
End With
End Function

Hope it helps
Regards from Brazil going to the 6th world championship
Marcelo



"Todd" escreveu:

I have a set of numbers with text in them and I need to remove the text.

32h
320h
4206h

The H is always last but has different numbers of digits before it. Its a
column of data I need to group and sum. The data comes from a query and is
refreshed frequently so the "h" has to be removed every time the query
refreshes. I planned to put a formula in a column right beside the query
data but can't figure out how to write the formula because the H has
different numbers of digits before it.

How can I do this?


Todd

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
How do I remove all spaces in a text string dn Excel Discussion (Misc queries) 3 April 2nd 23 07:20 PM
Filter text in a column by its Indent, to remove certain text 99TZ250 Excel Discussion (Misc queries) 1 May 21st 06 08:53 AM
How do I look up a number within a string of text Rich Hayes Excel Worksheet Functions 3 October 14th 05 05:49 PM
Remove characters from a text string using a formula duncrbrt Excel Discussion (Misc queries) 1 June 4th 05 02:19 AM
Finding Specific Text in a Text String Peter Gundrum Excel Worksheet Functions 9 April 10th 05 07:21 PM


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

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

About Us

"It's about Microsoft Excel"