Formulas and Functions

Formulas and Functions

Ask for help with your formula and find examples of how others use formulas and functions to solve a similar problem.

unexpected behavior with collect formula

Community Champion
edited 12/09/19 in Formulas and Functions

I believe this formula should work, and when I break it apart it seems to work but doesn't when together.

 

Copy from sheet

=JOIN(COLLECT({Range 1}, {Range 2}, IF($[By Shift]$1 = "All", @cell = @cell, @cell = $[By Shift]$1), {Range 3}, IF(ISNUMBER($[Within Last (Days)]$1), NETDAYS(@cell, TODAY()) < $[Within Last (Days)]$1, AND(@cell > $[Date Range]$1, @cell < $[Date Range]$2))), ",")

 

Easier to read/understand version

               ***Start Formula

=JOIN(COLLECT(

               ***Return Range

{Range 1},

              ***Criteria 1 Range

{Range 2},

               ***Criteria 1

IF($[By Shift]$1 = "All", @cell = @cell, @cell = $[By Shift]$1),

               ***Criteria 2 Range

{Range 3},

               ***Criteria 2

IF(ISNUMBER($[Within Last (Days)]$1), NETDAYS(@cell, TODAY()) < $[Within Last (Days)]$1, AND(@cell > $[Date Range]$1, @cell < $[Date Range]$2))), ",")

 

 

 

If I delete criteria 2, the formula works. Or if I delete the @cell = @cell in criteria 1 the formula works as expected. Also the formula works until i change [By Shift]1 to "All"

I wonder if there is a limit to the number of @cell references in a formula, or if I just limited out the power of smartsheet.

It seems like every part of the formula works in my testing until it is all together and referencing "All" and I get a invalid data type error. 

Tags:

Comments

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!

Trending in Formulas and Functions