ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Unnecessary conversion (https://www.excelbanter.com/excel-discussion-misc-queries/126288-unnecessary-conversion.html)

Stefi

Unnecessary conversion
 
Hi All,

I have a normal XL file generated by an application as output. There are
cells in it containing decimal numbers stored as text, e.g. "5.2".
When Opening this file XL converts strings recognizable as a date to dates,
like 2007/5/2.
What can I do to keep the original string "5.2" or convert it to a real
decimal number?

Regards,
Stefi


Pete_UK

Unnecessary conversion
 
In your example, you could add the formula:

=MONTH(A1)+DAY(A1)/10

to another cell, assuming the date is in A1. However, if you have a
mixture of dates and strings/numbers, it might be better to do
something like:

=IF(A135000,MONTH(A1)+DAY(A1)/10,VALUE(A1))

and format the cell as General, then copy this down the column. If the
"number" has been converted to a date, then it is likely to be larger
than 35000 (if a recent date), so it converts it as above, if not then
it just turns it into a number.

Hope this helps.

Pete

Stefi wrote:

Hi All,

I have a normal XL file generated by an application as output. There are
cells in it containing decimal numbers stored as text, e.g. "5.2".
When Opening this file XL converts strings recognizable as a date to dates,
like 2007/5/2.
What can I do to keep the original string "5.2" or convert it to a real
decimal number?

Regards,
Stefi



Stefi

Unnecessary conversion
 
Thanks Pete,

I thought of this way, but hoped there is a simpler way! If there is no one,
I'll try something like that!

Regards,
Stefi

€˛Pete_UK€¯ ezt Ć*rta:

In your example, you could add the formula:

=MONTH(A1)+DAY(A1)/10

to another cell, assuming the date is in A1. However, if you have a
mixture of dates and strings/numbers, it might be better to do
something like:

=IF(A135000,MONTH(A1)+DAY(A1)/10,VALUE(A1))

and format the cell as General, then copy this down the column. If the
"number" has been converted to a date, then it is likely to be larger
than 35000 (if a recent date), so it converts it as above, if not then
it just turns it into a number.

Hope this helps.

Pete

Stefi wrote:

Hi All,

I have a normal XL file generated by an application as output. There are
cells in it containing decimal numbers stored as text, e.g. "5.2".
When Opening this file XL converts strings recognizable as a date to dates,
like 2007/5/2.
What can I do to keep the original string "5.2" or convert it to a real
decimal number?

Regards,
Stefi





All times are GMT +1. The time now is 02:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com