Valid if dropdown as well as invalid error message

Hi,

I would like to have a enumlist column [occupied] which has a dropdown menu with a list of people who are attendees, by reading two other columns and using this formula as a valid_if:

LIST([head]) + [attendees]

I would also like the [occupied] column to show an invalid message if more than 5 entries are selected.

What I tried:

AND(
LIST([head]) + [attendees],
COUNT([_THIS]) > 5
)

This of course gives the error: invalid structure: subexpressions must be Yes/No conditions.

Is there a nice way to make this possible?

Thank you in advance.

Solved Solved
0 8 338
1 ACCEPTED SOLUTION

Workaround for this is to read values from the different table with the "Suggested value" and then have a validation that checks how many values you can select.

View solution in original post

8 REPLIES 8

Assuming the [head] is a text or name type column  and  [attendees] is an enumlist column, your valid_if  expression can be  COUNT(LIST([head]) + [attendees])<6

Thank you for your response. This adds the restriction of having only 5 max [occupied] entries, but it does not create dropdown menu containing all the options containg [head] and [attendees].

My question is if it is possible to have both. I could have a workaround applying this valid_if constraint to either [head] or [attendees] or anything else for that matter, but I was wondering it is possible to have a dropdown list cotaining these entries and having a max of 5 at the same time in the same column.

Okay got it. Please try in the valid if

IF(COUNT([_THIS])<5,
(LIST([head]) + [attendees]),
[_THIS])

This implementation needs the enumlist column's input mode to be set as "buttons" option. It does not work in the dropdown option.

Suvrutt_Gurjar_0-1672807143950.png

 

Workaround for this is to read values from the different table with the "Suggested value" and then have a validation that checks how many values you can select.

Thank you both for your suggestions. @AleksiAlkio Yours seems to do the trick exactly as it should. I'm wondering now why I was using valid_if to create a suggested list instead of using "Suggested value". Was this recently implemented or something? I learned it by using valid_if.

The "Suggested values" was introduced maybe two years ago for this purpose.. so it's not a new one ๐Ÿ™‚

Perfect, thank you! ๐Ÿ™‚

You're welcome 

Top Labels in this Space