Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number of Days in a Quarter

Status
Not open for further replies.

Christineeve

Programmer
Feb 12, 2005
104
US
I am terrible at understanding these IIF statements. Would you help me determine the number of days in a quarter, I'll pass in the date.

NumDaysInMonth=
First(DateSerial(Year(tbl_Cognos_GL_BS_YTD.Month),Int((Month(tbl_Cognos_GL_BS_YTD.Month)-1)/3)*3+1,1))

NumDaysInMonth2=
DateSerial(Year([NumDaysInMonth]),Month([NumDaysInMonth])+1,1)-DateSerial(Year([NumDaysInMonth]),Month([NumDaysInMonth]),1)

I'm passing in a date to NumDaysInMonth and it's finding the first day of the month. Then passing to the next forumla to find the number of days in a month.

There is probalby an easier way but I'm terrible at this IIFs. Anyway, if you would help me find the number of days in the quater, as determined by the month found in the first formula, I'd be grateful. Thank you!
Christine
 
Nevermind. It's been one of those days. I jsut had to change the 1 to a 3 in the second formula.

But, if you can improve on these statements, I'd love to benefit from your wisdom. Thank you.
 



Hi,

Hint:

LastDayOfMonth: =DateSerial(Year([yourDate]),Month([yourDate])+1,0)

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top