I'm a developer with Cognito Forms.
This is something that can be set up with Cognito Forms. You will need a total of 3 fields working together, and a custom error message set up on the Choice field set to checkbox with the 20 checkbox items.
To get started add a Choice field labeled 'Number of Area Selection' to your form, set to the type of 'Drop down'. You can update all of the field labels after the calculations have been set up, this way ensures that all the calculations work right off the bat. Enable the 'Assign Values' option on this Choice field. I then used the following choice options with the values.
The next field is the Choice field with the 20 Checkbox items. I labeled this field 'Practice Areas' with the type of 'Checkboxes'. We will be adding a custom error to this field. The custom error is going to be checking our previous Choice field, and the current number of selected choice options. If the number is outside of the set range then the error message that you set up will be displayed. The following calculation can be entered into the 'Advanced Editor' the error message that is used is up to you, but an error message has to be added or the error will not display at all.
=(NumberOfAreaSelection_Value = 1 and PracticeAreas.Count() >= 6) or (NumberOfAreaSelection_Value = 2 and (PracticeAreas.Count() <=5 or PracticeAreas.Count() >= 11))or (NumberOfAreaSelection_Value = 3 and (PracticeAreas.Count() <=10 or PracticeAreas.Count() >= 16)) or (NumberOfAreaSelection_Value = 4 and PracticeAreas.Count() <= 15)
When running on your form the above two fields will work together to provide the following.
The last field that we will be setting up is a Price field with the label of 'Price'. This field will check the number of selected items in the Checkbox Choice field. While this calculation is not needed, it will show you how to check the count and provide the correct price based on the count.
=if PracticeAreas.Count() = 0 then 0 else if PracticeAreas.Count() <= 5 then 200 else if PracticeAreas.Count() <= 10 then 300 else if PracticeAreas.Count <= 15 then 400 else if PracticeAreas.Count <= 20 then 500 else 0
If you would simply like to count the number of checked fields you can add a Calculation field to your form and target the Choice field, then add .Count(). To do this with the fields that I have set up you would need to use the following calculation.
I have gone over a lot of working parts, that can be a bit hard to follow. I'm including a link to the form that I built with each field set up and working.