ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Capture a number from a cell containing numbers and letters (https://www.excelbanter.com/excel-programming/381755-capture-number-cell-containing-numbers-letters.html)

Khurram

Capture a number from a cell containing numbers and letters
 
Hi all,
I need to capture the number from a cell that contains data in the
format "2.45 Days" or "3.6 Days". Is it possible to somehow remove the
"Days" elements and capture all else? I am doing this programatically
using VBA.

Thank you kindly

Khurram


Ron Rosenfeld

Capture a number from a cell containing numbers and letters
 
On 23 Jan 2007 10:04:20 -0800, "Khurram" wrote:

Hi all,
I need to capture the number from a cell that contains data in the
format "2.45 Days" or "3.6 Days". Is it possible to somehow remove the
"Days" elements and capture all else? I am doing this programatically
using VBA.

Thank you kindly

Khurram


So long as the format is as you show, with the numeric value coming first, the
Val function will return only the number:

e.g.

Debug.Print Val("3.6 days")
-- 3.6


--ron


All times are GMT +1. The time now is 07:51 PM.

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