ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy only the numbers from cells (https://www.excelbanter.com/excel-programming/292619-copy-only-numbers-cells.html)

Pandi[_2_]

Copy only the numbers from cells
 
I have some table that in one column I have some strings (for example):
"Sum : 148,626.35 Better and different"
"Sum : 193,500.00 Osem"

I want only the number will be copy to another column.

How do I do that

--
Message posted from http://www.ExcelForum.com


Serkan Gur[_2_]

Copy only the numbers from cells
 
Hi,

Write this code in a module you insert to your workbook
using VB Editor.

Public Function texttrim(a As String) As Double
Dim b As String
For i = 1 To Len(a)
If Asc(Mid(a, i, 1)) 43 And Asc(Mid(a, i, 1)) < 58 Then
b = b + Mid(a, i, 1)
Next
texttrim = b
End Function

This will make a new worksheet function =texttrim()
available in your workbook which does exactly what you
need. For example if the text to be trimmed is in cell A1,
enter =texttrim(A1) to any other cell and you will get
just the number.

Regards,

-----Original Message-----
I have some table that in one column I have some strings

(for example):
"Sum : 148,626.35 Better and different"
"Sum : 193,500.00 Osem"

I want only the number will be copy to another column.

How do I do that ?


---
Message posted from http://www.ExcelForum.com/

.



All times are GMT +1. The time now is 03:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com