Create a date from a month and year

Goal

You have a single-select field for the name of a month and a number field for a four digit year. You want to turn display this in the format MM/YYYY.

Picking a formula

As in many coding situations, there are many ways to accomplish this task. Picking the right formula is a balance between your coding abilities, how adaptable you want your code to be, how much error checking you want to do, and your tolerance for long formulas.

Simply convert the month name to a two digit string

One straightforward way of accomplishing this task is to simply convert the month name to a two digit string.

However, this method takes many lines and not very adaptable if you later decide to change the month format.

SWITCH({Long Month Name},
  "January", "01",
  "February", "02",
  "March", "03",
  "April", "04",
  "May", "05",
  "June", "06",
  "July", "07",
  "August", "08",
  "September", "09",
  "October", "10",
  "November", "11",
  "December", "12"
) & "/" & {Year Field}

Convert the month and date to a date object

Converting the month and year to a date object is a more robust method and allows one to do other date based functions.

If you later decide to change the month format, you only have to change one line.

DATETIME_PARSE(
  {Long Month Name} & "/1/" & {Year Field}, 
  'MMMM/D/YYYY'
)

Convert the date object to a string showing only the month and year

Once you have a date object, you can format it however you like.

DATETIME_FORMAT(
  DATETIME_PARSE(
    {Month Field} & "/1/" & {Year Field}, 
    'MMMM/D/YYYY'
  ),
  "MM/YYYY"
)

Add error checking if the month or year are missing

You can also add error checking to ensure that the date is a valid date, and show an error message if it is not.

IF(
  AND(
    {Long Month Name},
    {Year Field} > 0,
    {Year Field} < 10000
  ),
  DATETIME_FORMAT(
    DATETIME_PARSE(
      {Long Month Name} & "/1/" & {Year Field}, 
      'MMMM/D/YYYY'
    ),
    "MM/YYYY"
  ),
  "invalid date"
)

Demo Base

Test it out