Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Determining Cell Types in Excel - exceptions

No, the analogy isn't equivalent. The value in the cell is 37148. the
other is formatting. In this case, the difference is whether the value in
the cell is "1234" or 1234.

When you pick it up in an array directly, what is stored in the cell is
picked up - so "1234" stays "1234" and 1234 stays 1234.

Sub Tester5()
varr = Range("Data").Value
For i = LBound(varr, 1) To UBound(varr, 1)
sStr = i & " "
For j = LBound(varr, 2) To UBound(varr, 2)
If Application.IsNumber(varr(i, j)) Then
sStr = sStr & "True, "
Else
sStr = sStr & "False, "
End If
Next
Debug.Print sStr
Next
End Sub

demonstrates this.

half my cells were numbers stored as strings, the other half were numbers
stored as numbers. The array reflected this as well.

All that said, in code, if you write code that uses it as a number, then
more than likely, it will be implicitly converted.

--
Regards,
Tom Ogilvy


Tim Childs wrote in message
...
Tom

thanks for bearing with me on this.

the twist is that the data has been transferred to variant array and I am
checking whether it is possible to determine whether these functions work

in
the same way once in the array: I realise they work but the contents of

the
cell and the array contents are not necessarily interchangeable in this
context. To use an (imperfect) analogy isn't it something like the
difference between "37148" and the equivalent date-number "14-Sep-01" i.e.
the number label does not exist in the same way in the array as in the
workbook's cell.

any help/comment/feedback gratefully received.

Tim

"Tom Ogilvy" wrote in message
...
It wasn't terribly obvious what you question was/is. If you want to

know
whether the value in a cell is stored as text or number, you can use the
isText and IsNumber worksheet functions

=isNumber(A1) will tell you how it is stored. (likewise istext)

You can select the whole range and do
Edit=GoTo=Special and select Constants and Text or Constants and

Numbers
(after you paste special) to see which cells are being interpreted as
numbers and which as text.

So if determining how the information is stored in excel, then there are

two
methods.

--
Regards,
Tom Ogilvy

"Tim Childs" wrote in message
...
Tom

it is consistent, yes...but I know it is a number by
looking at it. But it is odd in that it is impossible to
produce this label-number with direct entry: Excel
automatically "processes" the string into a true value, if
you enter it from the keyboard.

I guess I hoped someone would come back with a formula of
the type "isnumeric" or some such thing that I may not
have come across.

THANKS

Tim

-----Original Message-----
your formula produces the String "123.67", so it would
seem consistent to
see it as text when you paste special.

if the formula were
=123.67

then if I do a paste special, it is a number.








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 can I hide unused file types from file types list in save dial Estra Q Excel Discussion (Misc queries) 1 December 17th 09 12:36 PM
Excel 2007 error "some chart types cannot be combined with other chart types. Select a different chart types" roadsidetree Charts and Charting in Excel 15 June 2nd 09 10:53 AM
Determining the text mode from a variety of data types matt3542 Excel Worksheet Functions 17 July 31st 08 08:01 PM
Need Excel formula to separate names into columns, with exceptions intuishawn Excel Discussion (Misc queries) 4 August 27th 07 04:31 PM
Determining whether selected cell has value or formula? John Wirt Excel Programming 3 July 31st 03 04:19 AM


All times are GMT +1. The time now is 12:27 PM.

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

About Us

"It's about Microsoft Excel"