my TEXT function won't work

  • Thread starter Thread starter Roger
  • Start date Start date
R

Roger

I have a spreadsheet with columns of data. The data is extracted from a
string using either the MID or LEFT functions, and then I use the TEXT
function to make sure it is formatted as text.One column is surnames which I
need to sort alphabetically A .. Z. Instead of sorting all of the list
alphabetically it sorts most of it, then after Z it has another 20 or so
names starting again from A through to Z.

Am I doing something wrong ... why won't it sort the whole column of names!

.... Roger
 
Hi Roger

it may be that you have some extraneous spaces from your formulae.
Assuming your names are in column A, try entering in another column
= TRIM(A1)
and copy down.
Then copy this helper column and Paste Special>Values back over the
original column A
Then Sort again.
 
Are you sure that you don't have leading characters (e.g., space,
non-breaking space, etc)? Check with LEN().
 
I have tried using TRIM, but all that happens is that I can see the formula
in the cell (ie I can see =TRIM(D2)) and it doesn't actually work. Do I need
to turn this function on somehow to see the result?

Thanks for your help .. Roger
 
You need to format your cell as something other than Text before you
enter your formula.
 
Hi Roger

If the formula is showing in the cell, not the result, then it sounds as
though the cell was formatted as Text.
Format the cell as General, then press F2 to edit, followed by Enter.
This should turn it to a formula.

Take note of JE's post about the non-breaking space character, as Trim
will not remove this.
If you find you have a problem after using trim, try
=SUBSTITUTE(SUBSTITUTE(D2,CHAR(160),"")," ","")
Again copy down, then Paste Special>Values back over the source column.
 
This is all very weird !!! I have tried to reformat as you suggest, but it
makes no difference. Even if I type in =TRIM(D2) into a new cell, it still
only shows me the formula. It there some global setting for the worksheet
which forces the view to formulae ?? that I need to reset or uncheck ?

Roger
 
Try Roger Govier's suggestion one more time. I bet you did things out of order.

Or maybe you're looking at formulas:
tools|options|view tab|make sure Formulas is not checked.
 
Hi Roger

Try Ctrl+` (that's hold down the control key and press the key to the
left of 1 on the top row of the keyboard)
 
Roger

Maybe you are in "Formula View"

Hit CTRL + `(backquote above Tab key)


Gord Dibben MS Excel MVP
 
Yes, I had Formulas checked somehow. Oh for the old days when we had a basic
excel spreadsheet !... however, thanks for all of your help .. Roger
 
Back
Top