You are viewing limited content. For full access, please sign in.

Question

Question

Forms Field Calculation - Getting the Month as January, February, etc.

asked on September 21, 2018

How would I pre-populate a Single Value field on a Form with the text form for the current month?  I know I can use =MONTH(TODAY()) to get the month as a number but I need it in long text form.  I tried this:  

=IF(MONTH(TODAY()) == 1, January, IF(MONTH(TODAY()) == 2, February, IF(MONTH(TODAY()) == 3, March, IF(MONTH(TODAY()) == 4, April, IF(MONTH(TODAY()) == 5, June, IF(MONTH(TODAY()) == 7, July, IF(MONTH(TODAY()) == 8, August, IF(MONTH(TODAY()) == 9, September, IF(MONTH(TODAY()) == 10, October, IF(MONTH(TODAY()) == 11, November, IF(MONTH(TODAY()) == 12, December)))))))))))

However I kept getting the Calculation Syntax Error for that textbox.  Any suggestions?

0 0

Answer

SELECTED ANSWER
replied on September 21, 2018 Show version history

Change double equals to singles in your IF comparisons, and wrap your text in double quotes.

For Example, 

=IF(MONTH(TODAY()) = 1, "January", "")

 

On a side note, you're supposed to be able to do something like TEXT(TODAY(),"mmmm") to format a date as a month name, but Forms doesn't seem to like that.

The documentation shows TEXT(value,format) as a valid option, but every time I try to add formatting it says "does not contain the correct number of input parameters"

4 0
replied on September 21, 2018

That worked.  Thanks :)

0 0
replied on March 25, 2019

Could you please do it for 12 months? When I try to use the above format for  12 months it says there are syntax errors.

0 0
replied on March 25, 2019

Can you clarify what you mean by "format for 12 months"

0 0
replied on March 25, 2019

I just got it working! From January to December


Thanks!

0 0
replied on August 6, 2019

@Jason Smith Were you ever able to get the TEXT function to work? I was trying to use it on my form like this and produced the same error you mentioned:

=TEXT(UploadDeadline, "mmmm d, yyyy")

0 0
replied on June 23, 2020

G'day all,

Same issue / error messages when trying the format parameter in TEXT() functions for dates. There's a good few formats to choose from in date fields, but not "YYYY/MM/DD" specifically. I've come very close with 

=YEAR(Date)&"/"&MONTH(Date)&"/"&DAY(Date)

but need leading zeros for month and day.

Trying to get a lookup working by populating a single line field with the date field variable then applying formatting, to workaround the serial number display and the aforementioned.

0 0
replied on April 9, 2021

Hello,

 

Kindly provide me the IF Comparison for 12 month.

I ve try the below but does not work

=IF(MONTH(TODAY()) = 1, "January",
IF(MONTH(TODAY()) = 2, "February",
IF(MONTH(TODAY()) = 3, "March",
IF(MONTH(TODAY()) = 4, "April",
IF(MONTH(TODAY()) = 5, "May",
IF(MONTH(TODAY()) = 6, "June",
IF(MONTH(TODAY()) = 7, "July",
IF(MONTH(TODAY()) = 8, "August",
IF(MONTH(TODAY()) = 9, "September",
IF(MONTH(TODAY()) = 10, "October",
IF(MONTH(TODAY()) = 11, "November",
IF(MONTH(TODAY()) = 12, "December"))))))))))))

 

Regards,

Arvind

1 0
replied on April 9, 2021

I just tried it & it works. I added your formula to the Month field. Based on the date I pick in the Date field, it will provide me the month.

Month.PNG
Month.PNG (3.17 KB)
0 0
replied on April 9, 2021

It works finally. Datestamp as date field on my forms

=IF(MONTH(Datestamp) = 1, "January",
IF(MONTH(Datestamp) = 2, "February",
IF(MONTH(Datestamp) = 3, "March",
IF(MONTH(Datestamp) = 4, "April",
IF(MONTH(Datestamp) = 5, "May",
IF(MONTH(Datestamp) = 6, "June",
IF(MONTH(Datestamp) = 7, "July",
IF(MONTH(Datestamp) = 8, "August",
IF(MONTH(Datestamp) = 9, "September",
IF(MONTH(Datestamp) = 10, "October",
IF(MONTH(Datestamp) = 11, "November",
IF(MONTH(Datestamp) = 12, "December",
""))))))))))))

5 0
replied on April 14, 2021 Show version history

Thank you for sharing this!

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.