Re: How do I know the text or number within cell?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi. In general, when one sorts strings like
"2328050010001023841"
and
"567"

Excel looks at the first character and will sort the string beginning with 2 before the string starting with 5
A general method might be to pad all string with 0's in the front to form a standard length string... then sort.
There are many ways to do this, but in general, perhaps form a new string from "567" by using something like this. (A2 is 567)

=RIGHT("0000000000000000000" & A2,19)

If you sort on this newer string, it should work as you expect.

--
HTH :>)
Dana DeLouis


"Eric" <Eric@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:ABC132C0-DA36-4370-BD74-D6F2BFD92682@xxxxxxxxxxxxxxxx
For my case, in cell A2, there is char 2328050010001023841. The value must be
string instead of number based on Excel's specifications has 15 digit
precision.

If I get a list of string under A column, does anyone have any suggestions
on how to sort it in ascending order based on macro coding?
Thank everyone very much for any suggestions
Eric


"Ron Rosenfeld" wrote:

On Sun, 18 May 2008 03:25:00 -0700, Eric <Eric@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

In cell A2, there is char 2328050010001023841.
I am not sure whether the char is text or number, does anyone have any
suggestions on how to force it into number?

You won't be able to do that in Excel. If you check Excel's specifications,
you will discover that it has 15 digit precision.
--ron


Relevant Pages

  • Re: Sorting
    ... Wouldn't it be easier to use a software package like Family Tree Maker ... Why do you think you can make Excel sort in a different manner ... you certainly cannot use Excel alone to sort your data. ... need a macro to sort each column twice by creating a text string ...
    (microsoft.public.excel.programming)
  • Re: VB6 LISTBOX problem
    ... Have a look at the code below, can you do a sort that is faster ... There are of course all sorts of ways of sorting stuff, especially stuf that is "linked together" as in your UDTs, but to prove the following code sorts it in exactly the same way that your own original code does so, by concatenating all three items of each element into a composite string exactly as you are already doing, but instead of dumping those composite strings into a ListBox it dumps them into a VB string array. ... Private Type SAFEARRAY1D ... Dim StPtr As Long, VAs String, pVAs Long ...
    (microsoft.public.vb.general.discussion)
  • C Sharp sorting considered superior to C by an order of magnitude
    ... following sort algorithms and the following points. ... its own comparision for the types bool, byte, short, int, long, ... single, double and string. ... private CheckBox CHKdeterminism; ...
    (comp.programming)
  • Re: Cant Figure Out How To Sort On Bind
    ... The sort order is not being passed as an argument, ... with the string "searchCache" to create a key for it, ... 'Assign ColumnOrder to ViewState ... Sub GetDataReader(ByVal ColumnOrder As String) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Chris Rockliffes Hofner.
    ... It looks disgusting - the original finish was a sort of pewkey ... pickups with one of those steel wire wool pan scrubbers - there was no ... strings in you have to push the trem fixture forward, ... Peter Green-ish tone. ...
    (rec.music.makers.guitar.acoustic)