EDIT: I made a few notes here as I was going through the XLSX (attached).
This is fine as-is because you are using count-selected() on its own. It's just the nature of count-selected() to give you the result you are looking for. But, if you combine this with other calculates you will likely run into issues:
This one wont work because you wrapped the entire end result in int(). Essentially, you are converting your string of separate numbers (e.g., 111 vs 3) into an integer. If you want this to work, each individual item needs its own int() (e.g., int(${field1}) + int(${field2}):
You use a lot of type hidden fields. This is not recommended:
The better approach is to select the appropriate data type (e.g., Integer) and then make the appearance hidden:
Because your IF statements use "null", you are adding stuff that shouldn't be added, meaning you may end up with this in some cases (NaN = Not a Number):
Looking at your formula, it may make more sense to swap a few things up.For example, most of your "hidden" fields should b calculates.
I also noticed you were missing your constraints for the spinners. This is how they should appear:
For future reference: calculates do not require a label, and notes do not require a name.
I have made some edits to the XLSX. I am not saying that it is perfect, but it should put you into the right direction (and all of your calculate fields at the end are working).