Days in a Month

Please let me now how can I extract the number of days a particular month has. Example If January is selected in a enum which has all months listed, it should show it has 31 days or if April is selected it should show 30 days.

Thanx.

Solved Solved
0 4 286
1 ACCEPTED SOLUTION

Somethingl ike below

First Column Type Enum called say [MonthsSelect]

valid If of this column {โ€œJanuaryโ€, February", โ€œFebruary-Leapโ€, โ€œMarchโ€, โ€œAprilโ€, โ€ฆ,โ€œNovembrtโ€, โ€œDecemberโ€}

Second Column Number type called say [MonthDays]
App formula for [MonthDays]

SWITCH([ MonthsSelect], โ€œJanuaryโ€, 31, โ€œFebruaryโ€, 28, โ€œFebruary-Leapโ€, 29, โ€œMarchโ€, 31,โ€œAprilโ€, 30, โ€ฆ,โ€œNovemberโ€, 30, โ€œDecemberโ€, 31, 30)

View solution in original post

4 REPLIES 4

In general, based on your requirement of enum based month name input to show the number of days, I believe the simplest approach is one could make a simple lookup for the enum. The number of days in all months is always fixed except February. So you could have two enum input values for February-Leap and February- Non leap as two options for February.

Please further elaborate on your requirement if there is some other requirement from apart from using just a month name enum. For example, using a date column as an input.

Basically I have 2 Columns the first one has the month which will be selected from the enum and another column which is number type will show the number of days in that month.

Can you give a small example code or formula for doing this?

I donโ€™t mind using another datatype like date or something if its easierโ€ฆ

Thanx.

Somethingl ike below

First Column Type Enum called say [MonthsSelect]

valid If of this column {โ€œJanuaryโ€, February", โ€œFebruary-Leapโ€, โ€œMarchโ€, โ€œAprilโ€, โ€ฆ,โ€œNovembrtโ€, โ€œDecemberโ€}

Second Column Number type called say [MonthDays]
App formula for [MonthDays]

SWITCH([ MonthsSelect], โ€œJanuaryโ€, 31, โ€œFebruaryโ€, 28, โ€œFebruary-Leapโ€, 29, โ€œMarchโ€, 31,โ€œAprilโ€, 30, โ€ฆ,โ€œNovemberโ€, 30, โ€œDecemberโ€, 31, 30)

You are a Genius! Thanks you so much!! God Bless That was perfect and Quick!!

I have one more question if you could please helpโ€ฆ

I have a Form with Barcode as text type column and I have a Product Name as a Ref. Column referring to the Product Master Table.

If the Barcode is entered and if the corresponding product is found it should show it otherwise it should let us select it from the Dropdown list.

Please help.

Thank you!!

Top Labels in this Space