Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Importing number with dash changes to date

I'm imporint data (which I have no control over) into Excel. Some of the
number contain 2 digits, a dash, then 6 more digits, for ex 02-9098 Excel
interprets that number as Feb 1, 9098. Changing the cell format to number or
text does not get the original value back, instead, I get 2629049 which is
obviously not correct.

Is there a way to undo the date and get the original number back?

Thanks,
Dee Sperling
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Importing number with dash changes to date

When you import the data (either programmatically or manually), tell Excel
that the field is Text. That way, no conversion will take place.
--
Gary''s Student - gsnu201001


"Dee Sperling" wrote:

I'm imporint data (which I have no control over) into Excel. Some of the
number contain 2 digits, a dash, then 6 more digits, for ex 02-9098 Excel
interprets that number as Feb 1, 9098. Changing the cell format to number or
text does not get the original value back, instead, I get 2629049 which is
obviously not correct.

Is there a way to undo the date and get the original number back?

Thanks,
Dee Sperling

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Importing number with dash changes to date

Hello Dee,
Excel 2007:
I framed in a group of cells.Then: Home, Number, Format Cells and Text. Now
it was
possible to enter 05-9078 without it being turned into a date 7000 years
from now.

Best Regards,

Gabor Sebo

"Dee Sperling" wrote in message
...
An Excel spreadsheet is being exported from a SQL database that I cannot
change, so I need to accomplish this in Excel.

Sometimes, some of the many numbers contain a dash which Excel then
interprets as a date. I can remove the dash programatically, but the
number
is not correct afterwards.
For example, the number imported is 05-9078 which is displayed in Excel as
May-78, but is actually stored as 5/1/9078. Changing the cell format to
number or text gives me 2621833.

I need to be able to add to my macro something that will give me back the
original number so that I can remove the dash and end up with 059078

Any help greatly appreciated.

Dee


"Dee Sperling" wrote in message
...
I'm imporint data (which I have no control over) into Excel. Some of the
number contain 2 digits, a dash, then 6 more digits, for ex 02-9098 Excel
interprets that number as Feb 1, 9098. Changing the cell format to number
or
text does not get the original value back, instead, I get 2629049 which is
obviously not correct.

Is there a way to undo the date and get the original number back?

Thanks,
Dee Sperling


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Importing number with dash changes to date

Hello Dee,

Too bad that you can't have the data resent to you.
In that case you could format the receiving area of cells as: Text.
The closest that you could recover the original data is if you take the
Feb-98 ( entered as 02-9098) cell and format it as date.
The result then is: 2/1/9098 which may be programmed to become 02-9098.

Best regards,

Gabor Sebo



"Dee Sperling" wrote in message
...
I'm imporint data (which I have no control over) into Excel. Some of the
number contain 2 digits, a dash, then 6 more digits, for ex 02-9098 Excel
interprets that number as Feb 1, 9098. Changing the cell format to number
or
text does not get the original value back, instead, I get 2629049 which is
obviously not correct.

Is there a way to undo the date and get the original number back?

Thanks,
Dee Sperling


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Importing number with dash changes to date

hello Dee,

I have entered 02-9098 into A1
came out as: Feb-98
specified date for cell, came out as: 2/1/9098
month(a1)=2
day(a1)=1
year(a1)=9098
giving you your "2" and "9098".
Drop me a note if this does not help.

Gabor

"Dee Sperling" wrote in message
...
I'm imporint data (which I have no control over) into Excel. Some of the
number contain 2 digits, a dash, then 6 more digits, for ex 02-9098 Excel
interprets that number as Feb 1, 9098. Changing the cell format to number
or
text does not get the original value back, instead, I get 2629049 which is
obviously not correct.

Is there a way to undo the date and get the original number back?

Thanks,
Dee Sperling




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
Number with dash is importing as date Dee Sperling[_2_] Excel Programming 8 March 29th 10 09:02 PM
replace dash in a number sequence Willy Wonka Excel Worksheet Functions 1 February 14th 08 12:04 AM
Extract number between a dash Eric Excel Discussion (Misc queries) 3 January 24th 08 12:37 AM
How do I take out a dash in a number like 827-6541 in a XL list Kelley Excel Worksheet Functions 11 December 26th 06 10:40 PM
Replacing dash in item number tmcleod Excel Discussion (Misc queries) 3 March 29th 06 12:14 AM


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