LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Assemble monthly periods between dates into a string

The program collects a BEGIN date and an END date from the user;
these are stored in variables as dates: mdPeriodBEG and mdPeriodEND;
no problem.

I now need to construct a string variable that incorporates all the
monthly periods in between, regardless of start and end dates given,
in a certain format. Examples:

1. Example: Given BEG: 10-2007; END: 02-2008; *

I need a string variable loaded with:
'Oct-07', 'Nov-07', 'Dec-07', 'Jan-08', 'Feb-08'

*Please note: crosses a calendar year

2. Example: Given BEG: 02-2008; END: 05-2008;

I need a string variable loaded with:
'Feb-08', 'Mar-08', 'Apr-08', 'May-08'

This format is required so I can ultimately feed this string variable of
dates into a SQL string. I know how to concatenate a string variable,
but I need an efficient method of doing so using variable start and end
periods.

Please note that due to the datatype being used in Oracle, I cannot
simply use BETWEEN in my SQL string, rather I must feed it each
individual period as shown in my example using the IN keyword.

I am at a loss on how to do this efficiently, but perhaps a select
case or two?

Thanks much in advance for your kind assistance.

 
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
Allocate Value Across Monthly Periods AlanR[_2_] Excel Worksheet Functions 1 October 26th 09 12:59 AM
Comparing data from 2 monthly periods in 1 chart Jamie Charts and Charting in Excel 2 November 30th 07 02:42 PM
How to subtract/add periods in monthly base? Eric Excel Discussion (Misc queries) 3 December 1st 06 04:06 AM
Dates and periods Coliber Excel Worksheet Functions 6 January 26th 06 09:14 PM
Number of semi-monthly periods between 2 dates sforr Excel Worksheet Functions 15 June 16th 05 03:45 AM


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