Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default change text in cell

Hello,

I have a worksheet with a column containing data in the format "###########"
I would like to change the values so that I can insert "dashes" at specific
locations, such as "##-####-####-#" for all the values in the column.

I tried the simple way...formating the cells, but when I run a formula, the
values don't match and I get an error, unless the dashes are actually
inserted.

Thank you in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default change text in cell


Nelson wrote:
Hello,

I have a worksheet with a column containing data in the format "###########"
I would like to change the values so that I can insert "dashes" at specific
locations, such as "##-####-####-#" for all the values in the column.

I tried the simple way...formating the cells, but when I run a formula, the
values don't match and I get an error, unless the dashes are actually
inserted.

Thank you in advance


what does the formula do?
After formatting is the cell text? May post your format code.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default change text in cell

Only values stored as numbers or cells containing formulas that return
numbers can be formatted to change the appearance as you show.

What do you mean by run a formula?

If you actually mean run code, then you want to look at the Text property
rather than the value property of the cell to see the formatted appearance of
the cell. This assumes the formatting in the cell does work.

--
Regards,
Tom Ogilvy


"Nelson" wrote:

Hello,

I have a worksheet with a column containing data in the format "###########"
I would like to change the values so that I can insert "dashes" at specific
locations, such as "##-####-####-#" for all the values in the column.

I tried the simple way...formating the cells, but when I run a formula, the
values don't match and I get an error, unless the dashes are actually
inserted.

Thank you in advance

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default change text in cell


Did you use the custom format?

Such as: ##-####-####-#

I tried this by entering 2345234553 in cells A1:A10 in then summing the
total in A12 formatted C12 with the custom format above then enter the
formula =A12 in cell C12 and it worked just fine. Give it a try and let
me know if it works.

Ed


--
patele
------------------------------------------------------------------------
patele's Profile: http://www.excelforum.com/member.php...o&userid=35849
View this thread: http://www.excelforum.com/showthread...hreadid=562876

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default change text in cell

Thanks for the reply,

Sorry for not being explicit on my previous post. What I have is two
documents containing information about the same it. One worksheet has the
product number (formated as text) in the ########### format, while the second
worksheet has the product number in the ##-####-####-# format.

There is additional information in one worksheet that I need to extract via
a vlookup formula, but since they product numbers don't match (due to the
absence of the dashes), I get errors in the returned value.

So, I simply need to add the dashes to the values in the cells.

Hope this clarifies the problem.

"Tom Ogilvy" wrote:

Only values stored as numbers or cells containing formulas that return
numbers can be formatted to change the appearance as you show.

What do you mean by run a formula?

If you actually mean run code, then you want to look at the Text property
rather than the value property of the cell to see the formatted appearance of
the cell. This assumes the formatting in the cell does work.

--
Regards,
Tom Ogilvy


"Nelson" wrote:

Hello,

I have a worksheet with a column containing data in the format "###########"
I would like to change the values so that I can insert "dashes" at specific
locations, such as "##-####-####-#" for all the values in the column.

I tried the simple way...formating the cells, but when I run a formula, the
values don't match and I get an error, unless the dashes are actually
inserted.

Thank you in advance



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default change text in cell

Assume A1 on the sheet with the formula contains a literal string that looks
like ##-####-####-# and you are looking on sheet2 that in column A has
string values that look like ###########

then you could use a formula like

=vlookup(substitute(a1,"-",""),Sheet2!A:B,2,false)

--
Regards,
Tom Ogilvy


"Nelson" wrote:

Thanks for the reply,

Sorry for not being explicit on my previous post. What I have is two
documents containing information about the same it. One worksheet has the
product number (formated as text) in the ########### format, while the second
worksheet has the product number in the ##-####-####-# format.

There is additional information in one worksheet that I need to extract via
a vlookup formula, but since they product numbers don't match (due to the
absence of the dashes), I get errors in the returned value.

So, I simply need to add the dashes to the values in the cells.

Hope this clarifies the problem.

"Tom Ogilvy" wrote:

Only values stored as numbers or cells containing formulas that return
numbers can be formatted to change the appearance as you show.

What do you mean by run a formula?

If you actually mean run code, then you want to look at the Text property
rather than the value property of the cell to see the formatted appearance of
the cell. This assumes the formatting in the cell does work.

--
Regards,
Tom Ogilvy


"Nelson" wrote:

Hello,

I have a worksheet with a column containing data in the format "###########"
I would like to change the values so that I can insert "dashes" at specific
locations, such as "##-####-####-#" for all the values in the column.

I tried the simple way...formating the cells, but when I run a formula, the
values don't match and I get an error, unless the dashes are actually
inserted.

Thank you in advance

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default change text in cell


Nelson wrote:
Thanks for the reply,

Sorry for not being explicit on my previous post. What I have is two
documents containing information about the same it. One worksheet has the
product number (formated as text) in the ########### format, while the second
worksheet has the product number in the ##-####-####-# format.

There is additional information in one worksheet that I need to extract via
a vlookup formula, but since they product numbers don't match (due to the
absence of the dashes), I get errors in the returned value.

So, I simply need to add the dashes to the values in the cells.

Hope this clarifies the problem.


Make sure both of your lists are the same datatype - either string or
number. also, you need to alphabetize your lookup range when using
vlookup. hope this helps

AR

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default change text in cell

No, you don't have to alphabatize your range if your are looking for an exact
match which appears to be the case here.

--
Regards,
Tom Ogilvy


"ducky" wrote:


Nelson wrote:
Thanks for the reply,

Sorry for not being explicit on my previous post. What I have is two
documents containing information about the same it. One worksheet has the
product number (formated as text) in the ########### format, while the second
worksheet has the product number in the ##-####-####-# format.

There is additional information in one worksheet that I need to extract via
a vlookup formula, but since they product numbers don't match (due to the
absence of the dashes), I get errors in the returned value.

So, I simply need to add the dashes to the values in the cells.

Hope this clarifies the problem.


Make sure both of your lists are the same datatype - either string or
number. also, you need to alphabetize your lookup range when using
vlookup. hope this helps

AR


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default change text in cell

Thanks for the reply.

What I have is actually in reverse. I have A1 with ########... and I need
to look up values that look like ##-###...

"Tom Ogilvy" wrote:

Assume A1 on the sheet with the formula contains a literal string that looks
like ##-####-####-# and you are looking on sheet2 that in column A has
string values that look like ###########

then you could use a formula like

=vlookup(substitute(a1,"-",""),Sheet2!A:B,2,false)

--
Regards,
Tom Ogilvy


"Nelson" wrote:

Thanks for the reply,

Sorry for not being explicit on my previous post. What I have is two
documents containing information about the same it. One worksheet has the
product number (formated as text) in the ########### format, while the second
worksheet has the product number in the ##-####-####-# format.

There is additional information in one worksheet that I need to extract via
a vlookup formula, but since they product numbers don't match (due to the
absence of the dashes), I get errors in the returned value.

So, I simply need to add the dashes to the values in the cells.

Hope this clarifies the problem.

"Tom Ogilvy" wrote:

Only values stored as numbers or cells containing formulas that return
numbers can be formatted to change the appearance as you show.

What do you mean by run a formula?

If you actually mean run code, then you want to look at the Text property
rather than the value property of the cell to see the formatted appearance of
the cell. This assumes the formatting in the cell does work.

--
Regards,
Tom Ogilvy


"Nelson" wrote:

Hello,

I have a worksheet with a column containing data in the format "###########"
I would like to change the values so that I can insert "dashes" at specific
locations, such as "##-####-####-#" for all the values in the column.

I tried the simple way...formating the cells, but when I run a formula, the
values don't match and I get an error, unless the dashes are actually
inserted.

Thank you in advance

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 do i change cell text colour based on value in other cell Oscarrot Excel Worksheet Functions 2 July 20th 09 03:21 PM
Change Text Color in one cell based upon entry in referenced cell Tee Excel Discussion (Misc queries) 3 September 12th 08 10:07 PM
How do I change replace text in a cell for different text? ronedwards Excel Worksheet Functions 4 August 18th 06 03:31 AM
How to change cell text based on another selected cell? jjh Excel Discussion (Misc queries) 1 July 6th 06 01:14 PM
Change text on one cell based on text in another Sally B. Excel Discussion (Misc queries) 1 June 30th 06 03:22 PM


All times are GMT +1. The time now is 04:25 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"