glabossi
asked on
What's wrong with this quarterly date formula?
This formula was created by Frodoman back in July and I am just using it now. But I am getting an error requiring a string after FALSE. Can someone tell me where I went wrong?
If month(currentdate) = 4 then
{MBRSUM.CREATE_DATE} & " in " & date(1,1,year(currentdate) ) & " to " & date(1,3,year(currentdate) )
else
If month(currentdate) = 7 then
{MBRSUM.CREATE_DATE} & " in " & date(1,4,year(currentdate) ) & " to " & date(1,6,year(currentdate) )
else
If month(currentdate) = 10 then
{MBRSUM.CREATE_DATE} & " in " & date(1,7,year(currentdate) ) & " to " & date(1,9,year(currentdate) )
else
If month(currentdate) = 1 then
{MBRSUM.CREATE_DATE} & " in " & date(1,10,year(currentdate )) & " to " & date(1,12,year(currentdate ))
else
false
If month(currentdate) = 4 then
{MBRSUM.CREATE_DATE} & " in " & date(1,1,year(currentdate)
else
If month(currentdate) = 7 then
{MBRSUM.CREATE_DATE} & " in " & date(1,4,year(currentdate)
else
If month(currentdate) = 10 then
{MBRSUM.CREATE_DATE} & " in " & date(1,7,year(currentdate)
else
If month(currentdate) = 1 then
{MBRSUM.CREATE_DATE} & " in " & date(1,10,year(currentdate
else
false
ASKER
I am not very familiar with strings. Could you give me an example I could use with this string dylanyee?
Thank you.
Thank you.
ASKER
The FALSE was supposed to end the formula. It was supposed to prevent monthly values from showing up when it wasn't the current quarter (since I am setting it to run monthly in Crystal Enterprise).
glabossi, in your case, it depends on you to decide what should the formula return if it wasn't the belongs to current quarter, the example below simply replace the false to "", you could change it to anything. such as "false"
If month(currentdate) = 4 then
{MBRSUM.CREATE_DATE} & " in " & date(1,1,year(currentdate) ) & " to " & date(1,3,year(currentdate) )
else
If month(currentdate) = 7 then
{MBRSUM.CREATE_DATE} & " in " & date(1,4,year(currentdate) ) & " to " & date(1,6,year(currentdate) )
else
If month(currentdate) = 10 then
{MBRSUM.CREATE_DATE} & " in " & date(1,7,year(currentdate) ) & " to " & date(1,9,year(currentdate) )
else
If month(currentdate) = 1 then
{MBRSUM.CREATE_DATE} & " in " & date(1,10,year(currentdate )) & " to " & date(1,12,year(currentdate ))
else
""
If month(currentdate) = 4 then
{MBRSUM.CREATE_DATE} & " in " & date(1,1,year(currentdate)
else
If month(currentdate) = 7 then
{MBRSUM.CREATE_DATE} & " in " & date(1,4,year(currentdate)
else
If month(currentdate) = 10 then
{MBRSUM.CREATE_DATE} & " in " & date(1,7,year(currentdate)
else
If month(currentdate) = 1 then
{MBRSUM.CREATE_DATE} & " in " & date(1,10,year(currentdate
else
""
ASKER
I tried putting in the "" after else and I received an error (a number must be between 1 and the number of days in a month) for this line in the formula:
date(1,1,year(currentdate) )
date(1,1,year(currentdate)
ASKER
Any help here?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
eg)
IF month(currentdate) = 4 then
"some string here"
else
true
this will cause an syntax error because it expect a string after else. the correct syntax will be
IF month(currentdate) = 4 then
"some string here"
else
"must be string as well"
So in your case, you should change the "false" to some string instead.
dylan