PC Review


Reply
Thread Tools Rate Thread

Convert a range of numbers to strings

 
 
Curious
Guest
Posts: n/a
 
      12th Aug 2010
Download a list and past as value. Because vlookup function demands
text format, I need to convert the numbers into strings. If I loop the
list, and convert the cells one by one, it works, but takes a long
time. I am trying to convert the whole range with no luck.

I tried something like
Selection = format (selection,”@”)
Named range =format (named range,”@”)

Even manually select the range--> format cells-->Category:Text, still
didn’t work.

I use the function TYPE to monitor the cell's type. After I think I
get the format changed, the TYPE continues to show “1”.

Interestingly enough, after I reformat a cell, if I retyped the
number, it suddenly worked, that is, my vlookup function suddenly
recognized the number as text.

My questions are
(1) Why formatting a cell does not take immediate effect with a
vlookup function or with a type function?
(2) How can I convert the whole range into string?

Thank you in advance.

 
Reply With Quote
 
 
 
 
James Ravenswood
Guest
Posts: n/a
 
      12th Aug 2010
On Aug 12, 10:35*am, Curious <wise...@yahoo.com> wrote:
> Download a list and past as value. Because vlookup function demands
> text format, I need to convert the numbers into strings. If I loop the
> list, and convert the cells one by one, it works, but takes a long
> time. I am trying to convert the whole range with no luck.
>
> I tried something like
> Selection = format (selection,”@”)
> Named range =format (named range,”@”)
>
> Even manually select the range--> format cells-->Category:Text, still
> didn’t work.
>
> I use the function TYPE to monitor the cell's type. After I think I
> get the format changed, the TYPE continues to show “1”.
>
> Interestingly enough, after I reformat a cell, if I retyped the
> number, it suddenly worked, that is, my vlookup function suddenly
> recognized the number as text.
>
> My questions are
> (1) Why formatting a cell does not take immediate effect with a
> vlookup function or with a type function?
> (2) How can I convert the whole range into string?
>
> Thank you in advance.


1. reformating a cell does not change its contents
2. try:

Sub FixThem()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For Each r In Selection
With r
st = .Text
.Clear
.NumberFormat = "@"
.Value = st
End With
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
 
Reply With Quote
 
Pete_UK
Guest
Posts: n/a
 
      12th Aug 2010
You could select those cells, click on Data | Text-to-Columns, then
click Finish.

Another way is not to change them but to change your formula,
something like this:

=VLOOKUP(A1&"",lookup_table,col,0)

Hope this helps.

Pete

On Aug 12, 3:35*pm, Curious <wise...@yahoo.com> wrote:
> Download a list and past as value. Because vlookup function demands
> text format, I need to convert the numbers into strings. If I loop the
> list, and convert the cells one by one, it works, but takes a long
> time. I am trying to convert the whole range with no luck.
>
> I tried something like
> Selection = format (selection,”@”)
> Named range =format (named range,”@”)
>
> Even manually select the range--> format cells-->Category:Text, still
> didn’t work.
>
> I use the function TYPE to monitor the cell's type. After I think I
> get the format changed, the TYPE continues to show “1”.
>
> Interestingly enough, after I reformat a cell, if I retyped the
> number, it suddenly worked, that is, my vlookup function suddenly
> recognized the number as text.
>
> My questions are
> (1) Why formatting a cell does not take immediate effect with a
> vlookup function or with a type function?
> (2) How can I convert the whole range into string?
>
> Thank you in advance.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert a 8X3 table to a vertical range of the Unique strings only מיכ×ל (מיקי) ×בידן ® Microsoft Excel Worksheet Functions 8 2nd May 2009 08:13 AM
convert range of numbers in one record into range of single-number records shadowsong@gmail.com Microsoft Access Queries 15 28th Jul 2007 02:39 AM
Convert a range to a 2sequence of numbers? =?Utf-8?B?Q2hyaXN0aW5l?= Microsoft Excel Worksheet Functions 10 29th Oct 2006 08:07 PM
Convert range of numbers to letter JB Microsoft Excel Discussion 10 2nd Mar 2006 10:33 PM
convert range numbers to letter JB Microsoft Access 2 1st Mar 2006 04:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:16 AM.