Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,814
Default & in formula changing date format to text ?

I have this formula in a cell
=D12+1&" - " &D12+5
It produces this : 39528 - 39532
The cell format in the cell shows as m/dd/yy
D12 = 3/20/08
I would like it to produce
3/21/08 - 3/25/08

If I lose everyting in the cell except the D12+1, the result is the correct
date.
I believe the & is causing the format to change to the date#'s instead of
the date.

How can I get the cell to produce 3/21/08 - 3/25/08 ?

Thanks,

Steve



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,311
Default & in formula changing date format to text ?

Since your cell can't be formatted as a date due to the additional data or
text that is being produced, then the output will be automatically displayed
as Text. You could get your desired result with:

=MONTH(D12)&"/"&DAY(D12)+1&"/"&YEAR(D12)&" -
"&MONTH(D12)&"/"&DAY(D12)+5&"/"&YEAR(D12)

HTH,
Paul


--

"Steve" wrote in message
...
I have this formula in a cell
=D12+1&" - " &D12+5
It produces this : 39528 - 39532
The cell format in the cell shows as m/dd/yy
D12 = 3/20/08
I would like it to produce
3/21/08 - 3/25/08

If I lose everyting in the cell except the D12+1, the result is the
correct
date.
I believe the & is causing the format to change to the date#'s instead of
the date.

How can I get the cell to produce 3/21/08 - 3/25/08 ?

Thanks,

Steve





  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default & in formula changing date format to text ?

I believe the & is causing the format to change to the date#'s instead of
the date.


You're concatenating TEXT into the formula so the result is a TEXT string
which ignores number formatting.

Try it like this:

=TEXT(D12+1,"m/dd/yy")&" - "&TEXT(D12+5,"m/dd/yy")


--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
I have this formula in a cell
=D12+1&" - " &D12+5
It produces this : 39528 - 39532
The cell format in the cell shows as m/dd/yy
D12 = 3/20/08
I would like it to produce
3/21/08 - 3/25/08

If I lose everyting in the cell except the D12+1, the result is the
correct
date.
I believe the & is causing the format to change to the date#'s instead of
the date.

How can I get the cell to produce 3/21/08 - 3/25/08 ?

Thanks,

Steve





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,814
Default & in formula changing date format to text ?

Thanks guys. Both worked great.

Much appreciated,

Steve

"T. Valko" wrote:

I believe the & is causing the format to change to the date#'s instead of
the date.


You're concatenating TEXT into the formula so the result is a TEXT string
which ignores number formatting.

Try it like this:

=TEXT(D12+1,"m/dd/yy")&" - "&TEXT(D12+5,"m/dd/yy")


--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
I have this formula in a cell
=D12+1&" - " &D12+5
It produces this : 39528 - 39532
The cell format in the cell shows as m/dd/yy
D12 = 3/20/08
I would like it to produce
3/21/08 - 3/25/08

If I lose everyting in the cell except the D12+1, the result is the
correct
date.
I believe the & is causing the format to change to the date#'s instead of
the date.

How can I get the cell to produce 3/21/08 - 3/25/08 ?

Thanks,

Steve






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default & in formula changing date format to text ?

You're welcome!

--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
Thanks guys. Both worked great.

Much appreciated,

Steve

"T. Valko" wrote:

I believe the & is causing the format to change to the date#'s instead
of
the date.


You're concatenating TEXT into the formula so the result is a TEXT string
which ignores number formatting.

Try it like this:

=TEXT(D12+1,"m/dd/yy")&" - "&TEXT(D12+5,"m/dd/yy")


--
Biff
Microsoft Excel MVP


"Steve" wrote in message
...
I have this formula in a cell
=D12+1&" - " &D12+5
It produces this : 39528 - 39532
The cell format in the cell shows as m/dd/yy
D12 = 3/20/08
I would like it to produce
3/21/08 - 3/25/08

If I lose everyting in the cell except the D12+1, the result is the
correct
date.
I believe the & is causing the format to change to the date#'s instead
of
the date.

How can I get the cell to produce 3/21/08 - 3/25/08 ?

Thanks,

Steve










  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 41
Default & in formula changing date format to text ?

Thanks Paul. I was able to use this formula to compare two fields brought in
with two different formattings.


"PCLIVE" wrote:

Since your cell can't be formatted as a date due to the additional data or
text that is being produced, then the output will be automatically displayed
as Text. You could get your desired result with:

=MONTH(D12)&"/"&DAY(D12)+1&"/"&YEAR(D12)&" -
"&MONTH(D12)&"/"&DAY(D12)+5&"/"&YEAR(D12)

HTH,
Paul


--

"Steve" wrote in message
...
I have this formula in a cell
=D12+1&" - " &D12+5
It produces this : 39528 - 39532
The cell format in the cell shows as m/dd/yy
D12 = 3/20/08
I would like it to produce
3/21/08 - 3/25/08

If I lose everyting in the cell except the D12+1, the result is the
correct
date.
I believe the & is causing the format to change to the date#'s instead of
the date.

How can I get the cell to produce 3/21/08 - 3/25/08 ?

Thanks,

Steve






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
Macro to Change Changing Date Format Data to Text Rod Bowyer Excel Discussion (Misc queries) 3 October 11th 07 12:02 PM
Changing text to date format CM[_2_] Excel Discussion (Misc queries) 2 March 14th 07 12:10 PM
changing text to date format mcamp Excel Worksheet Functions 8 February 8th 07 08:51 PM
Formula for changing date format juamig Excel Worksheet Functions 2 May 9th 06 07:43 PM
How to format date as text without changing appearance? [email protected] Excel Discussion (Misc queries) 4 May 18th 05 09:25 AM


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"