Count Rows Where A Value in Multiple Columns is blank

Is it possible to count how many lines meet certain criteria AND have a blank value in Column 1 OR Column 2 OR Column 3? For example I have a Smartsheet with a questionnaire and am currently trying to calculate metrics from the answers in said questionnaire. One of my metrics is "Level 1 Completion" (which is equal to "Q1 or Q2 or Q3 has a value, or is not blank") for NeedBy Date in 8 weeks, by location.

For example, in the following table, I would get these:

image.png

Reno= 1

Elko= 1

Carson City= 1

I tried:

=COUNTIFS({QuestionnairreLocal}, [Primary Column]@row, {QuestionnaireNeedDate}, @cell <= TODAY(112), {QuestionnaireNeedDate}, @cell >= TODAY(105), (OR({QuestionnaireQ1}, <>"", {QuestionnaireQ2}, <>"", {QuestionnaireQ3}, <>"")).

However when I do this, I get #INVALID DATA TYPE.

Suggestions for if and how I can count the number of rows in my questionnaire Smartsheet that meet this criteria

Answers

  • Cory Page
    Cory Page ✭✭✭✭✭

    Hello, i was taking a look at your question but I may need a bit more information as I don't understand the table and expected results you mentioned above.

    I broke things down so that we could see each criteria but in my examples I only show Reno as having met your criteria of 8 weeks out, with 1 blank value? Above you said all 3 locations should flag as 1, can you please explain a little more about your criteria.. Thanks,

    image.png


  • Yes!

    It may be easier to focus on Carson City as that is mainly my issue:

    Carson City has two rows with dates within my 8 week range, however none of the questions have been answered in one row (i.e. Q1, Q2, or Q3 lack an answer/or are blank).

    For Reno, they each have an answer in Q1, or Q2, or Q3, but one row is outside the 8 week window.

    I'm looking for # of rows (not cells) that meet criteria (location, 8 weeks) where Q1, OR Q2, OR Q3 "is not blank".


    Does that clarify my issue?

  • Cory Page
    Cory Page ✭✭✭✭✭

    Am I getting closer?

    In the current sheet we have 0 locations that meet that criteria so a count would be 0?

    Locations within the 8 week window that do not have any "Blank Values" in Q1 - Q3 should be 0?

    If we ignored the 8 week criteria then the only one that would count would be Reno Row 1 in this case.

    I could be getting mixed up with the "where Q1, OR Q2, OR Q3" as I am thinking they all need to be "Not blank" in order to count. Sorry, just trying to help.

  • I think my original example wasn't clear:

    I want to count how many rows in my sheet meet the following criteria:

    Needby Date is between 8-9 weeks

    There is a value in Q1 or Q2 or Q3 (either "Yes" or "No") (any can be blank, but a minimum of 1 of them should have a value).

    And I want to show this in a table represented by Location.

    image.png


    Line 1: Location is Reno, NeedBy Date does not fall between 8-9weeks, therefore not counted.

    Line 2: Location is Reno, NeedBy Date falls between 8-9 weeks, and has an answer in Q2, and Q3, so it's counted.

    Reno= 1

    Line 3: Location is Elko, NeedBy Date falls between 8-9 weeks, and has an answer in Q3, so it's counted.

    Elko = 1

    Line 4: Location is Carson City, NeedBy Date falls between 8-9 weeks, and does not have an answer for Q1 or Q2, or Q3, so it's not counted.

    Line 5: Location is Carson City, NeedBy Date falls between 8-9 weeks, and has an answer in Q1 and Q3, so it's counted.

    Carson City = 1

    So, if this was in a tabular form it would be (ultimately I am looking for the formular for "Level 1 Completion that calculates the above automatically):

    image.png


  • Cory Page
    Cory Page ✭✭✭✭✭
    edited 07/25/23

    Perfection, sorry that took a bit to understand. I have something quick to show you that might work pending on if you can add a helper or not. Let me know if there is anything you need updated hopefully its closer than previous tries.. :)

    @Peggy S.Update: Almost missed the part where you wanted to be in between 8 and 9 weeks, I fixed the formula.

    image.png


    公式1:计算8到9周砰的一声ure, you could add this formula into the if statement "Formula 2" if you want I kept it separate to keep things simple and clean.

    =SUM(NETDAYS(TODAY(), [Need by Date]1) / 7

    image.png

    Formula 2: Calculate the count: The value was needed to sum as this seems to dump the count to a text making it difficult to sum on a different sheet.

    =IF([Weeks into the future]@row >= 10, "Falls after 9 weeks", VALUE(IF(IF(AND([Weeks into the future]@row <= 9, [Weeks into the future]@row >= 8), COUNTIFS([Q1]@row:[Q3]@row, <>""), "0") > 0, "1", "0")))

    image.png

    Formula 2: Option without the "Falls after 9 weeks" Flag

    =VALUE(IF(IF(AND([Weeks into the future]@row <= 9, [Weeks into the future]@row >= 8), COUNTIFS([Q1]@row:[Q3]@row, <>""), "0") > 0, "1", "0"))


    Formula 3: Used for rolling up based on location: I use sumifs by default but you could just do sumif if you want

    =SUMIFS([Count of non-blank cells]1:[Count of non-blank cells]5, Location1:Location5, [Other sheet Primary]@row)

    image.png


  • Is there a way to add these helper columns to my calculation sheet, and not have them in the main questionnaire sheet? I believe that is my biggest roadblock. Due to capacity, I'm limited on adding columns to my questionnaire sheet.

  • Cory Page
    Cory Page ✭✭✭✭✭
    edited 07/26/23

    @Peggy S.It would be a pretty crazy formula if we wanted to do this without a helper but I think I have an idea.

    Q = Once questionnaire is updated in the main sheet will this data ever change or is it locked in forever? I am thinking we might be able to simply set up some automation to copy the main sheet over to a second sheet that can then be used for our helpers.

    Q = Do you use Webforms to populate this data or is the sheet directly access. If you use webforms these helpers wouldn't need to be shown on the form and if the helpers are set to Column formulas once the form is submitted the formula's would simply update. Just curious.

    If the Q1 - 3 columns were vertical rather than horizontal it would make things a bit easier the layout of the data is a bit tricky.


    Update: Yea, the best I can do is get down to one helper column by merging the week count into the one helper. I am sure there is someone out there that might have a solution but I am stumped as to how to make this calculation without a helper or creating a copy automation to keep a secondary sheet for the calculations. If the data is submitted and never changed a secondary sheet would be the best solution I can think of if the primary sheet can't have any more columns added.

    =VALUE(IF(IF(AND(SUM(NETDAYS(TODAY(), [Need by Date]1) / 7) <= 9, SUM(NETDAYS(TODAY(), [Need by Date]1) / 7) >= 8), COUNTIFS([Q1]@row:[Q3]@row, <>""), "0") > 0, "1", "0"))

  • Thank you! I was able to get permission to add helper cells to the main sheet (questionnaire) and was able to add your original "check if/or" function. I appreciate the insight!

  • Cory Page
    Cory Page ✭✭✭✭✭

    That's great news, the other options would have required a bit more work to manage long term.. Glad I was able to help..

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out theFormula Handbook template!
Hi, <\/p>

Instead of applying the formula to \"Multiselect Text String\" row, did you tried with \"Multiselect Values\" row?<\/p>

=IF(HAS([Multiselect Values]@row, [Component ID]@row), \"MATCH\", \"NO MATCH\")<\/p>

Thank you,<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":109493,"type":"question","name":"I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","excerpt":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5 different statuses in a separate column. So using the screenshot I've provided as an example (although it doesn't have 5 different statuses in the…","snippet":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5…","categoryID":322,"dateInserted":"2023-08-25T20:03:21+00:00","dateUpdated":null,"dateLastComment":"2023-08-26T00:34:49+00:00","insertUserID":165710,"insertUser":{"userID":165710,"name":"SmarsheetNewb","url":"https:\/\/community.smartsheet.com\/profile\/SmarsheetNewb","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:33:27+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":161714,"lastUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-27T02:16:35+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":26,"score":null,"hot":3386005690,"url":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109493,"commentID":392692,"name":"Re: I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392692#Comment_392692","dateInserted":"2023-08-26T00:34:49+00:00","insertUserID":161714,"insertUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-08-27T02:16:35+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-26T00:33:25+00:00","dateAnswered":"2023-08-25T20:44:12+00:00","acceptedAnswers":[{"commentID":392662,"body":"

Try this:<\/p>

=COUNTIFS([Item Number]:[Item Number], OR(@cell = \"C001\", @cell = \"COO2\", @cell = \"COO3\", @cell = \"COO4\"), [Status]:[Status], OR(@cell = \"Green\", @cell = \"Yellow\", @cell = \"Red\"))<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":109474,"type":"question","name":"Help with date calculation formula","excerpt":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the resolution date is blank I want it to use the current date in the calculation to see how long this issue has gone unresolved. Any help is much…","snippet":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the…","categoryID":322,"dateInserted":"2023-08-25T16:29:39+00:00","dateUpdated":"2023-08-25T16:29:59+00:00","dateLastComment":"2023-08-25T23:01:30+00:00","insertUserID":165688,"insertUser":{"userID":165688,"name":"Nwest","title":"Systems Analyst","url":"https:\/\/community.smartsheet.com\/profile\/Nwest","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ukHVZ18ImX4!BcjWAe8S9SY!l7iQo_PZHOx","dateLastActive":"2023-08-25T17:22:30+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":165688,"lastUserID":8888,"lastUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":25,"score":null,"hot":3385987269,"url":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109474,"commentID":392687,"name":"Re: Help with date calculation formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392687#Comment_392687","dateInserted":"2023-08-25T23:01:30+00:00","insertUserID":8888,"insertUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T17:04:22+00:00","dateAnswered":"2023-08-25T16:36:59+00:00","acceptedAnswers":[{"commentID":392622,"body":"

\n \n https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula\n <\/a>\n<\/div>\n

Hi, <\/p>

I hope you're well and safe!<\/p>

Try something like this.<\/p>

=IF([Date Reported]@row <> \"//www.santa-greenland.com/community/discussion/108050/\", IF([Resolution Date]@row = \"//www.santa-greenland.com/community/discussion/108050/\", NETDAYS([Date Reported]@row, TODAY()), NETDAYS([Date Reported]@row, [Resolution Date]@row)))<\/p>

Did that work\/help? <\/p>

I hope that helps!<\/p>

Be safe, and have a fantastic weekend!<\/p>

Best,<\/p>

Andrée Starå<\/strong><\/a> | Workflow Consultant \/ CEO @ WORK BOLD<\/strong><\/a><\/p>

Did my post(s) help or answer your question or solve your problem? Please support the Community by <\/em>marking it Insightful\/Vote Up, Awesome, or\/and as the accepted answer<\/em><\/strong>. It will make it easier for others to find a solution or help to answer!<\/em><\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=322&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":10000,"limit":3},"title":"Trending in Formulas and Functions ","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending in Formulas and Functions