Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing Text to Numeric Vals
hello~
I am looking for the proper method to compare non-numeric (text) vals to numeric vals. Is there a way to modify the script so that if cell.Value was a text val it could be interpreted as a numeric val? Something like: Number(cell.Value) in my script: If cell.Offset(0, -1) < cell.Value And Not _ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing Text to Numeric Vals
DJS,
The Val function will return 0 if the cell value is non-numeric. So if...Range("A1").Value = 10 and Range("A2").Value = "Butter" Dim x as Double x = (Range("A1").Value - Val(Range("A2").Value )) (x will equal 10) Jim Cone San Francisco, USA "DJS" wrote in message . hello~ I am looking for the proper method to compare non-numeric (text) vals to numeric vals. Is there a way to modify the script so that if cell.Value was a text val it could be interpreted as a numeric val? Something like: Number(cell.Value) in my script: If cell.Offset(0, -1) < cell.Value And Not _ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing Text to Numeric Vals
I'm not quite sure if you mean compare 1 with "one" or 1 with "1a".
If you mean the latter, take a look at Val. e.g. 21 = Val("21 tum ti tum") would evaluate to true. HTH, Gareth DJS wrote: hello~ I am looking for the proper method to compare non-numeric (text) vals to numeric vals. Is there a way to modify the script so that if cell.Value was a text val it could be interpreted as a numeric val? Something like: Number(cell.Value) in my script: If cell.Offset(0, -1) < cell.Value And Not _ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why do I get #NUM! for a GEOMEAN calc on a set of positive vals | Excel Worksheet Functions | |||
Numeric in Text to convert back to the form of Numeric for VLookup Purposes | Excel Discussion (Misc queries) | |||
How get rid of these errors if cell has no vals? | Excel Worksheet Functions | |||
Max of integer vals | Excel Programming | |||
Max of integer vals | Excel Programming |