hi, in this case month means last Friday of the month to last Thursday of the 
month. Eg: 28dec2012 to 31 january 2013.and 1 feb 2013 to 28feb 2013, and 1 
march 2013 to 28march 2013.


 quarter means from 28 dec 2012 - 28march 2013, and 29 march 2013 to 27june 2013

half year means for eg : 28dec 2012 - 27june 2013, then 28 june 2013 to 
26dec2013

yearly means 28dec2012 - 26dec 2013

any month starts from last Friday of the month and ends on last Thursday of 
next month.

this is the pattern of contracts followed in indian stock markets.


Pls find the file attched.

Thanks in adv.


________________________________
 From: De Premor <d...@premor.net>
To: excel-macros@googlegroups.com 
Sent: Friday, July 26, 2013 6:40 AM
Subject: Re: $$Excel-Macros$$ Date doubt
 


First Approach
This function is to find first Friday on every given range, is this
    match to your requirement ? if not, please reply with data and date
    as you want on each range.
Confuse on this statement "month from last Friday to last Thursday
    of the month.", sample data needed.

Function findFriday(FindDate As Date, Optional NextFriday As Integer = 1, 
Optional Mode As String = "W") As Date
    FindDate = FindDate - 1
    Select Case UCase(Mode)
        Case "W", "WEEKLY"
            FindDate = DateAdd("ww", NextFriday, FindDate)
        Case "M", "MONTHLY"
            FindDate = DateAdd("m", NextFriday, FindDate)
        Case "Q", "QUATERLY"
            FindDate = DateAdd("q", NextFriday, FindDate)
        Case "H", "HALFYEARLY"
            FindDate = DateAdd("q", NextFriday, FindDate)
            FindDate = DateAdd("q", NextFriday, FindDate)
        Case "Y", "YEARLY"
            FindDate = DateAdd("yyyy", NextFriday, FindDate)
    End Select
    Do
        FindDate = FindDate + 1
    Loop Until Weekday(FindDate) = 6
    findFriday = FindDate
End Function



On 25/07/2013 21:58, Kenil Gala wrote:

Hi friends,
>
>
>i have a query for arranging dates in a pattern.
>Pls help me solve my query.
>
>
>Thanks in adv.
>
>
-- 
>Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna
      be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this
      forum @ https://www.facebook.com/discussexcel
> 
>FORUM RULES
> 
>1) Use concise, accurate thread titles. Poor thread titles, like
      Please Help, Urgent, Need Help, Formula Problem, Code Problem, and
      Need Advice will not get quick attention or may not be answered.
>2) Don't post a question in the thread of another member.
>3) Don't post questions regarding breaking or bypassing any
      security measure.
>4) Acknowledge the responses you receive, good or bad.
>5) Jobs posting is not allowed.
>6) Sharing copyrighted material and their links is not allowed.
> 
>NOTE : Don't ever post confidential data in a workbook. Forum
      owners and members are not responsible for any loss.
>--- 
>You received this message because you are subscribed to the Google
      Groups "MS EXCEL AND VBA MACROS" group.
>To unsubscribe from this group and stop receiving emails from it,
      send an email to excel-macros+unsubscr...@googlegroups.com.
>To post to this group, send email to excel-macros@googlegroups.com.
>Visit this group at http://groups.google.com/group/excel-macros.
>For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.


Attachment: Date doubt.xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12

Reply via email to