MONTH HELP

G

Guest

I have a column [days] in my access query that houses a formual of [dte of
pay]-[dte ref]. The results of this formula calculate into a range of 0 -
2281 days. What I need to do is create another column that will tell me the
number of months it has been. So, I if [days] between 0 and 30 days [month]
will be 1. If [days] is betwen 31 and 60 days [month will be 2.
Any help on how to do this would be greatly appreciated.

Thanks.
 
S

Stefan Hoffmann

hi,
So, I if [days] between 0 and 30 days [month]
will be 1. If [days] is betwen 31 and 60 days [month will be 2.
If you are using financial months á 30 days:

Months: [days] \ 30


mfG
--> stefan <--
 
G

Guest

This doesn't really work. When I do this I get [days] 0-29 = 0 and
[days]30-59 = 1. I need it to work like below. So close. This will save so
much time.
Any help is appreciated.

Stefan Hoffmann said:
hi,
So, I if [days] between 0 and 30 days [month]
will be 1. If [days] is betwen 31 and 60 days [month will be 2.
If you are using financial months á 30 days:

Months: [days] \ 30


mfG
--> stefan <--
 
S

Stefan Hoffmann

hi,
This doesn't really work. When I do this I get [days] 0-29 = 0 and
[days]30-59 = 1. I need it to work like below. So close. This will save so
much time.
Why don't you simply add 1?

MonthsNotOffByOne: [days] \ 30 + 1


mfG
--> stefan <--
 
G

Guest

This was a good idea but when [days]=30 the [month] will then = 2 when it
should equal 1.

Stefan Hoffmann said:
hi,
This doesn't really work. When I do this I get [days] 0-29 = 0 and
[days]30-59 = 1. I need it to work like below. So close. This will save so
much time.
Why don't you simply add 1?

MonthsNotOffByOne: [days] \ 30 + 1


mfG
--> stefan <--
 
S

Stefan Hoffmann

hi,
This was a good idea but when [days]=30 the [month] will then = 2 when it
should equal 1.
Then do another addition:

MonthsHopefullyNiceNow: ([days] + 1) \ 30 + 1


mfG
--> stefan <--
 
G

Guest

Acutally the formula should be
MonthsHopefullyNiceNow: ([days] - 1) \ 30 + 1
but thank you so much for leading me in the correct direction. This is
going to save me an entire day....



Stefan Hoffmann said:
hi,
This was a good idea but when [days]=30 the [month] will then = 2 when it
should equal 1.
Then do another addition:

MonthsHopefullyNiceNow: ([days] + 1) \ 30 + 1


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Excel Colour code dates 1
DATEDIFF EXPRESSION 4
Previous Month Query 5
Days in part of the month 1
Excel Need aid in Excel Formulas 3
Network Days 3
Number of days between 2 dates 7
Excel Microsoft excel interest formula 2

Top