Is there a work around for trying to use CONTAINS() or HAS() within collect()?

I am trying to summarize my projects data that is assigned to a work type, dates/weeks specifically and then count it by week or singe day. Can't figure it out.


I have a summary sheet that brings in a multi select column (I have also tried it just text) off all the dates each work type has work. I am then on a separate sheet for each date trying to count the number of times each one of the columns has a date within it.


Best Answer

  • Devin Lee
    Devin Lee ✭✭✭✭✭
    Answer ✓

    Hey @Greg F

    Little bit confused on what you are trying to do. Looks like you want to count the number of times a date appears on the Summary Sheet for a specific Work Type and display that count on the Count Sheet. If that is what you are looking for something like the formula below could work for you.

    This is the formula without the references.

    =COUNT(COLLECT([Software Engineer]:[Software Engineer], [Software Engineer]:[Software Engineer], HAS(@cell, [Date of Work]@row)))
    

    Replaced with references would look something like this.

    =COUNT(COLLECT({Ref 1:[Software Engineer]:[Software Engineer]}, {Ref 1:[Software Engineer]:[Software Engineer]}, HAS(@cell, [Date of Work]@row)))
    


Answers

  • Greg F
    Greg F ✭✭✭

    I can get it to tell me if a single project has a work type on a given day but not if multiple are using

    =IF(CONTAINS([Date Column]@row, COLLECT({Work Type}, {Work Type}, <>"", {Work Type}, <>"First Row")), 1, 0)

  • Devin Lee
    Devin Lee ✭✭✭✭✭
    Answer ✓

    Hey @Greg F

    Little bit confused on what you are trying to do. Looks like you want to count the number of times a date appears on the Summary Sheet for a specific Work Type and display that count on the Count Sheet. If that is what you are looking for something like the formula below could work for you.

    This is the formula without the references.

    =COUNT(COLLECT([Software Engineer]:[Software Engineer], [Software Engineer]:[Software Engineer], HAS(@cell, [Date of Work]@row)))
    

    Replaced with references would look something like this.

    =COUNT(COLLECT({Ref 1:[Software Engineer]:[Software Engineer]}, {Ref 1:[Software Engineer]:[Software Engineer]}, HAS(@cell, [Date of Work]@row)))
    


  • Greg F
    Greg F ✭✭✭

    Thank you! This worked!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!