Need help with 2 formulas and counting

Emily McNeeley
Emily McNeeley ✭✭✭✭✭
edited 01/20/22 in Formulas and Functions

Need help building the following:

  1. Need to count the number of lines with a specific type where it's a multiselect. So =COUNTIFS({Master Contract List Template Contract Type}, [Contract Information]@row, {Master Contract List Template Status}, "Review & Redline") but contract type is a multi-select so need a "Has"?
  2. Need the following values (Request, Review & Redline, Out for Signature, Document Management) in one column to display as "Pending" in another

Best Answers

  • Jeff Reisman
    Jeff Reisman ✭✭✭✭✭✭
    Answer ✓

    When you want to know if a multi-select column cell contains a specific text string (among other text in the cell,) you'll want to use the CONTAINS function. For example, if looking for "Monday" in a multi-select cell showing both "Monday" and "Tuesday", HAS will return false because the entire cell needs to match the criteria, whereas CONTAINS will return true because the cell contains the searched-for string. Try this:

    =COUNTIFS({Master Contract List Template Contract Type}, [Contract Information]@row, {Master Contract List Template Status}, CONTAINS("Review & Redline", @cell))


    For your second question, you can use OR and CONTAINS inside an IF statement to return your value of "Pending" based on the status. Try this in the column you want to show "Pending" in.

    =IF(OR(CONTAINS("Request", Status@row), CONTAINS("Review & Redline", Status@row), CONTAINS("Out for Signature", Status@row), CONTAINS("Document Management", Status@row), "Pending", "")

    Regards,

    Jeff Reisman

    Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages

    If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!

  • Jeff Reisman
    Jeff Reisman ✭✭✭✭✭✭
    Answer ✓

    In that case, you just need to wrap an IF around your current formula, one that excludes Vendor Parent Count = 0:

    =IF([Vendor Parent Count]@row = 0, "", IF(OR(CONTAINS("Request", Status@row), CONTAINS("Review & Redline", Status@row), CONTAINS("Out for Signature", Status@row), CONTAINS("Document Management", Status@row), "Pending", "Executed"))

    If Vendor Parent Count on this row = 0, leave the cell blank, otherwise run this other formula.

    Regards,

    Jeff Reisman

    Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages

    If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!

Answers

  • Jeff Reisman
    Jeff Reisman ✭✭✭✭✭✭
    Answer ✓

    When you want to know if a multi-select column cell contains a specific text string (among other text in the cell,) you'll want to use the CONTAINS function. For example, if looking for "Monday" in a multi-select cell showing both "Monday" and "Tuesday", HAS will return false because the entire cell needs to match the criteria, whereas CONTAINS will return true because the cell contains the searched-for string. Try this:

    =COUNTIFS({Master Contract List Template Contract Type}, [Contract Information]@row, {Master Contract List Template Status}, CONTAINS("Review & Redline", @cell))


    For your second question, you can use OR and CONTAINS inside an IF statement to return your value of "Pending" based on the status. Try this in the column you want to show "Pending" in.

    =IF(OR(CONTAINS("Request", Status@row), CONTAINS("Review & Redline", Status@row), CONTAINS("Out for Signature", Status@row), CONTAINS("Document Management", Status@row), "Pending", "")

    Regards,

    Jeff Reisman

    Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages

    If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!

  • Emily McNeeley
    Emily McNeeley ✭✭✭✭✭
  • Emily McNeeley
    Emily McNeeley ✭✭✭✭✭

    @Jeff Reisman Quick question - I want to update the formula =IF(OR(CONTAINS("Request", Status@row), CONTAINS("Review & Redline", Status@row), CONTAINS("Out for Signature", Status@row), CONTAINS("Document Management", Status@row), "Pending", "Executed") to not count parent rows. I have a column called Vendor Parent Count and is running an ancestor formula. So anywhere that the Vendor Parent Count is 0, should be blank

  • Jeff Reisman
    Jeff Reisman ✭✭✭✭✭✭
    Answer ✓

    In that case, you just need to wrap an IF around your current formula, one that excludes Vendor Parent Count = 0:

    =IF([Vendor Parent Count]@row = 0, "", IF(OR(CONTAINS("Request", Status@row), CONTAINS("Review & Redline", Status@row), CONTAINS("Out for Signature", Status@row), CONTAINS("Document Management", Status@row), "Pending", "Executed"))

    If Vendor Parent Count on this row = 0, leave the cell blank, otherwise run this other formula.

    Regards,

    Jeff Reisman

    Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages

    If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!

  • Emily McNeeley
    Emily McNeeley ✭✭✭✭✭

    I was so close - thanks!!!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!