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.

Adding Checkbox Not Checked to Working Formula

I have a working formula that I'd like to add a condition to, if possible. Here is the working formula:

=IF(ISERROR(MEDIAN(COLLECT({Resi - Pricing & Tools Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31))))), "", MEDIAN(COLLECT({Resi - Pricing & Tools Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31)))))

where I am taking the median of any values that fall within the month of July 2023 and displaying a blank cell if there is no data that matches the criteria.

I'd now like to also make sure to include only those values in the median calculation where the "Resi - HOLD" column is not checked. I thought that it would be a simple addition but have been receiving an #INVALID OPERATION error. Here is how I modified the formula to include the criteria with the "Resi - HOLD" column:

=IF(ISERROR(MEDIAN(COLLECT({Resi - Pricing & Tools Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31))))), "", MEDIAN(COLLECT({Resi - Pricing & Tools Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31), ({Resi - HOLD} = 0)))))

Thoughts on what might be missing?

Best Answer

  • Community Champion
    Answer ✓

    try removing the desk - hold from the end function and instead tacking it to the end of the collect function.

    =MEDIAN(COLLECT({Resi - PRCC Ready Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31),{Resi - Hold},0)))

    One issue I saw is that your criteria range {Resi - Enter Stage 7 Date} won’t have the check box in it. So you have to move it from the collect function.

    If you found this comment helpful. Please respond with any of the buttons below. Awesome🖤, Insightful💡, Upvote⬆️, or accepted answer. Not only will this help others searching for the same answer, but help me as well. Thank you.

Answers

  • Community Champion

    you have an un needed ( infront of your Resi-hold that i bolded. as well as an extra ) due most likely to the first issue.

    =IF(ISERROR(MEDIAN(COLLECT({Resi - Pricing & Tools Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31))))), "", MEDIAN(COLLECT({Resi - Pricing & Tools Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31), ({Resi - HOLD} = 0)))))

    =IF(ISERROR(MEDIAN(COLLECT({Resi - Pricing & Tools Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31))))), "", MEDIAN(COLLECT({Resi - Pricing & Tools Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31), {Resi - HOLD} = 0))))

    If you found this comment helpful. Please respond with any of the buttons below. Awesome🖤, Insightful💡, Upvote⬆️, or accepted answer. Not only will this help others searching for the same answer, but help me as well. Thank you.

  • ✭✭✭✭✭

    Removing those ( ) didn't seem to fix the error so I stripped it down, removed all of the error-handling portion, and was left with this formula. It is giving me an #INVALID OPERATION error:

    =MEDIAN(COLLECT({Resi - PRCC Ready Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31), {Resi - HOLD} = 0)))

    I figured that I could easily add the error-handling back in but need to be successful with the core formula.

  • Community Champion

    what format is the date that’s in well the date column of your formula?

    If you found this comment helpful. Please respond with any of the buttons below. Awesome🖤, Insightful💡, Upvote⬆️, or accepted answer. Not only will this help others searching for the same answer, but help me as well. Thank you.

  • ✭✭✭✭✭

    Date format:

    The original formula works but then does not when I add the part to look at another column to verify that there is no checkmark in that column. This portion is what I was trying to add: {Resi - HOLD} = 0

  • Community Champion
    Answer ✓

    try removing the desk - hold from the end function and instead tacking it to the end of the collect function.

    =MEDIAN(COLLECT({Resi - PRCC Ready Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2023, 7, 1), @cell <= DATE(2023, 7, 31),{Resi - Hold},0)))

    One issue I saw is that your criteria range {Resi - Enter Stage 7 Date} won’t have the check box in it. So you have to move it from the collect function.

    If you found this comment helpful. Please respond with any of the buttons below. Awesome🖤, Insightful💡, Upvote⬆️, or accepted answer. Not only will this help others searching for the same answer, but help me as well. Thank you.

  • ✭✭✭✭✭

    @Mark.poole , that was it! Thank you! The new working formula is:

    =MEDIAN(COLLECT({Resi - PRCC Ready Duration}, {Resi - Enter Stage 7 Date}, AND(@cell >= DATE(2024, 2, 1), @cell <= DATE(2024, 2, 29)), {Resi - HOLD}, 0))

    Continuing the development of this formula, the checkbox range {Resi - HOLD} gets checked or not from a dashboard input so that the user can calculate the median of {Resi - PRCC Ready Duration} in the selected date range including the data that has a check in the {Resi - HOLD} column (=0) or excluding the data based upon the check in the {Resi - HOLD} column (=1).

    Is it possible to have this 0 or 1 value to populate the formula from the sheet as in {Resi - HOLD}, {value from sheet})) with the 'value from sheet' being a 0 or 1?

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!

Trending in Formulas and Functions

  • I'm trying to create a SUMIF formula that looks at the salesperson name in a column and adds up or totals their $ sales in another column. To ultimately show in Dashboard of Totals Sales by Salesperso…
    User: "Allan Z"
    Answered ✓
    9
    2
  • Good day Smartsheet Team, Getting an unparseable error on this formula: =IF($Name@row <> "",(SUMIFS({Expense}, {Period},1, {Type}, OR(@cell = "RES602782", @cell = "RES602497")),"") Trying to pull in a…
    User: "stratman"
    Answered ✓
    15
    2
  • I have a sheet that compiles all the responses from a form. The sheet has multiple start and end date columns, but only one start and one end date cell is NOT blank depending on the activity selected …
    User: "m_anderson"
    Answered ✓
    13
    2