Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Quarterly date format issues

Hi,

I am writing writing a subroutine which works with a series of quarterly
dates (e.g. "Q3-08, Q4-08, Q1-09, Q2-09,..." in a single row. I had wanted
to use CDate in my routine, but I can't get it to work with the date format I
am using. Any thoughts?
--
Hugo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Quarterly date format issues


You could use hidden cells - eg put 01/07/2008. 01/10/2008, 01/01/2009 in row
1 and then

="Q"&int(month(A1)-1)/3)+1&" "&year(A1)

in cell A2 etc (assuming you want calendar quarters and not financial ones)


"Hugo" wrote:

Hi,

I am writing writing a subroutine which works with a series of quarterly
dates (e.g. "Q3-08, Q4-08, Q1-09, Q2-09,..." in a single row. I had wanted
to use CDate in my routine, but I can't get it to work with the date format I
am using. Any thoughts?
--
Hugo

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Quarterly date format issues


Assuming you have assigned the "quarter date" to a variable named CellVal,
this statement will assign the quarter's start date to the indicated
variable...

QuarterDate = CDate("1-" & Choose(Mid(CellVal, 2, 1), _
"Jan-", "Apr-", "Jul-", "Oct-") & Right(CellVal, 2))

--
Rick (MVP - Excel)


"Hugo" wrote in message
...
Hi,

I am writing writing a subroutine which works with a series of quarterly
dates (e.g. "Q3-08, Q4-08, Q1-09, Q2-09,..." in a single row. I had
wanted
to use CDate in my routine, but I can't get it to work with the date
format I
am using. Any thoughts?
--
Hugo


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Quarterly date format issues


Try

Msgbox "Q" &format(Date,"q-yy")

Replace Date() with your date variable..

If this post helps click Yes
---------------
Jacob Skaria


"Hugo" wrote:

Hi,

I am writing writing a subroutine which works with a series of quarterly
dates (e.g. "Q3-08, Q4-08, Q1-09, Q2-09,..." in a single row. I had wanted
to use CDate in my routine, but I can't get it to work with the date format I
am using. Any thoughts?
--
Hugo

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Quarterly date format issues


Here is another way to do it (again, assuming CellVal contains the text of
your "quarter date" cell)...

QDate = DateAdd("q", Mid(CellVal, 2, 1) - 1, "1-Jan-" & Right(CellVal, 2))

where I used QDate instead of QuarterDate as the receiving variable because
that name is short enough to allow the entire statement to print on a single
line (without word wrapping) in your news reader.

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Assuming you have assigned the "quarter date" to a variable named CellVal,
this statement will assign the quarter's start date to the indicated
variable...

QuarterDate = CDate("1-" & Choose(Mid(CellVal, 2, 1), _
"Jan-", "Apr-", "Jul-", "Oct-") & Right(CellVal, 2))

--
Rick (MVP - Excel)


"Hugo" wrote in message
...
Hi,

I am writing writing a subroutine which works with a series of quarterly
dates (e.g. "Q3-08, Q4-08, Q1-09, Q2-09,..." in a single row. I had
wanted
to use CDate in my routine, but I can't get it to work with the date
format I
am using. Any thoughts?
--
Hugo





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Quarterly date format issues

Hugo,

Now I understood where your question came from..Please check your other post.

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Try

Msgbox "Q" &format(Date,"q-yy")

Replace Date() with your date variable..

If this post helps click Yes
---------------
Jacob Skaria


"Hugo" wrote:

Hi,

I am writing writing a subroutine which works with a series of quarterly
dates (e.g. "Q3-08, Q4-08, Q1-09, Q2-09,..." in a single row. I had wanted
to use CDate in my routine, but I can't get it to work with the date format I
am using. Any thoughts?
--
Hugo

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
counting records by month and year / date format issues Barbara Sabatino Excel Discussion (Misc queries) 2 March 21st 11 11:52 PM
Date Auto-detect & format Issues uw805 Excel Discussion (Misc queries) 2 April 17th 07 07:42 AM
Date Format Issues Access to Excel RC Excel Discussion (Misc queries) 3 June 13th 06 11:28 AM
date format/charting issues Monty Excel Discussion (Misc queries) 1 April 18th 06 07:15 PM
Update a Date Quarterly BD Excel Worksheet Functions 1 August 19th 05 04:01 PM


All times are GMT +1. The time now is 07:16 PM.

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"