Hello, I need help with a formula combing average, value, collect, and contains. I am trying to pull data from another sheet pulling out just the values from the selected options (options are 4 - Complete Success, 3 - Success with Minor Risk, 2 - Success with Major Risk and 1 - Process Breakdown) and then to average them IF the Month and Year meet certain criteria. I cannot figure out where in the formula I am going wrong. Below is the current version of the formula. I have also listed two separate formulas that work, I just can't figure out how to combine them together.
Doesn't work (Invalid Argument):
=IFERROR(AVG(COLLECT(VALUE(IF(CONTAINS("4", {Friendly Greeting}), "4", IF(CONTAINS("3", {Friendly Greeting}), "3", IF(CONTAINS("2", {Friendly Greeting}), "2", IF(CONTAINS("1", {Friendly Greeting}), "1"))))), {Year}, "2023", {Month}, "1")), "-")
Both work:
=IFERROR(AVG(COLLECT({Percentage Score}, {Year}, "2022", {Month}, "12")), "-")
and
=AVG(VALUE(IF(CONTAINS("4", {Friendly Greeting}), "4", IF(CONTAINS("3", {Friendly Greeting}), "3", IF(CONTAINS("2", {Friendly Greeting}), "2", IF(CONTAINS("1", {Friendly Greeting}), "1", ""))))))
Please let me know if you need any additional information from me. Thanks!