Add Numeric Fields together if a checkbox is checked
Hi, I'm building an app where the project is projecting out 5 years, but the project owner might only ask for funding for 1 or 2 years (to keep costs manageable, but they need to project to 5 years).
I made a multi-choice field to select which years is the "current ask".
Year 1, Year 2, Year 3, Year 4, Year 5 (these are formula checkbox)
Then that field is a lookup on the table "resources" where all of the details/math/etc are done.
I have checkboxes on the resources table that says
Year 1 ask
year 2 ask, and so on.
I want to calculate the financials for the "current ask". So If Year 2, and Year 3 are the "current ask", then take Year 2 Financials, and Year 3 financials and add them together to give me a total for those years.
Here's the formula I've come up with:
var text checkbox = (ToText([Year 1 Ask] or [Year 2 Ask] or [Year 3 Ask] or [Year 4 ask]));
If($checkbox = "true",
Nz([YEAR 1]) + Nz([YEAR 2]) + Nz([YEAR 3]) + Nz([YEAR 4]) + Nz([YEAR 5]))
I'm getting a syntax error every which way I turn. What is the correct way to write this?
Try this
IF([Year 1 Ask], [YEAR 1],0)
+
IF([Year 2 Ask], [YEAR 2],0)
+
IF([Year 3 Ask], [YEAR 3],0)
+
IF([Year 4 Ask], [YEAR 4],0)
+
IF([Year 5 Ask], [YEAR 5],0)