IF/AND Formula

Formulas are the bane of my existence and I really need to take a class! Today I'm trying to set up a formula to throw a flag when 2 conditions are met. I want a red ball when I have not received an invoice and the invoice due date is within 30 days. I know I'm close since I've gone from "unparsable" to "incorrect argument"! Here is what I have:

=IF([Invoice Received?]@row = 0, IF(AND([Renewal Date]@row >= TODAY(), [Renewal Date]@row <= TODAY(+30), "Red")))

How do I fix??

Best Answers

  • Carson Penticuff
    Carson Penticuff ✭✭✭✭✭✭
    Answer ✓

    You were, indeed, very close.

    =IF([Invoice Received?]@row = 0, IF(AND([Renewal Date]@row >= TODAY(), [Renewal Date]@row <= TODAY(+30)), "Red"))

  • SteyJ
    SteyJ ✭✭✭
    Answer ✓
    Formulas are the bane of my existence and I really need to take a class! Today I'm trying to set up a formula to throw a flag when 2 conditions are met. I want a red ball when I have not received an invoice and the invoice due date is within 30 days. I know I'm close since I've gone from "unparsable" to "incorrect argument"! Here is what I have:<\/p>

    =IF([Invoice Received?]@row = 0, IF(AND([Renewal Date]@row >= TODAY(), [Renewal Date]@row <= TODAY(+30), "Red")))<\/p>

    How do I fix??<\/p>","bodyRaw":"[{\"insert\":\"Formulas are the bane of my existence and I really need to take a class! Today I'm trying to set up a formula to throw a flag when 2 conditions are met. I want a red ball when I have not received an invoice and the invoice due date is within 30 days. I know I'm close since I've gone from \\\"unparsable\\\" to \\\"incorrect argument\\\"! Here is what I have:\\n=IF([Invoice Received?]@row = 0, IF(AND([Renewal Date]@row >= TODAY(), [Renewal Date]@row <= TODAY(+30), \\\"Red\\\")))\\nHow do I fix??\\n\"}]","format":"rich","dateInserted":"2023-08-11T16:27:44+00:00","insertUser":{"userID":120231,"name":"Pamela Wagner","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Pamela%20Wagner","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-11T17:47:38+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"displayOptions":{"showUserLabel":false,"showCompactUserInfo":true,"showDiscussionLink":true,"showPostLink":true,"showCategoryLink":false,"renderFullContent":false,"expandByDefault":false},"url":"https:\/\/community.smartsheet.com\/discussion\/108861\/if-and-formula","embedType":"quote","name":"IF\/AND Formula"}"> https://community.smartsheet.com/discussion/108861/if-and-formula

    It looks like you forgot to close out theANDfuntion. Try this

    =IF([Invoice Received?]@row = 0, "Green", IF(AND([Renewal Date]@row >= TODAY(0), [Renewal Date]@row <= TODAY(+30)), "Red", "Yellow"))

    Hope this helps!

    Jacob Stey

    Patriot Group International

Answers

  • Carson Penticuff
    Carson Penticuff ✭✭✭✭✭✭
    Answer ✓

    You were, indeed, very close.

    =IF([Invoice Received?]@row = 0, IF(AND([Renewal Date]@row >= TODAY(), [Renewal Date]@row <= TODAY(+30)), "Red"))

  • SteyJ
    SteyJ ✭✭✭
    Answer ✓
    Formulas are the bane of my existence and I really need to take a class! Today I'm trying to set up a formula to throw a flag when 2 conditions are met. I want a red ball when I have not received an invoice and the invoice due date is within 30 days. I know I'm close since I've gone from "unparsable" to "incorrect argument"! Here is what I have:<\/p>

    =IF([Invoice Received?]@row = 0, IF(AND([Renewal Date]@row >= TODAY(), [Renewal Date]@row <= TODAY(+30), "Red")))<\/p>

    How do I fix??<\/p>","bodyRaw":"[{\"insert\":\"Formulas are the bane of my existence and I really need to take a class! Today I'm trying to set up a formula to throw a flag when 2 conditions are met. I want a red ball when I have not received an invoice and the invoice due date is within 30 days. I know I'm close since I've gone from \\\"unparsable\\\" to \\\"incorrect argument\\\"! Here is what I have:\\n=IF([Invoice Received?]@row = 0, IF(AND([Renewal Date]@row >= TODAY(), [Renewal Date]@row <= TODAY(+30), \\\"Red\\\")))\\nHow do I fix??\\n\"}]","format":"rich","dateInserted":"2023-08-11T16:27:44+00:00","insertUser":{"userID":120231,"name":"Pamela Wagner","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Pamela%20Wagner","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-11T17:47:38+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"displayOptions":{"showUserLabel":false,"showCompactUserInfo":true,"showDiscussionLink":true,"showPostLink":true,"showCategoryLink":false,"renderFullContent":false,"expandByDefault":false},"url":"https:\/\/community.smartsheet.com\/discussion\/108861\/if-and-formula","embedType":"quote","name":"IF\/AND Formula"}"> https://community.smartsheet.com/discussion/108861/if-and-formula

    It looks like you forgot to close out theANDfuntion. Try this

    =IF([Invoice Received?]@row = 0, "Green", IF(AND([Renewal Date]@row >= TODAY(0), [Renewal Date]@row <= TODAY(+30)), "Red", "Yellow"))

    Hope this helps!

    Jacob Stey

    Patriot Group International

  • Pamela Wagner
    Pamela Wagner ✭✭✭✭✭✭

    Thanks@SteyJ! I made one tweak:

    =IF([Invoice Received?]@row = 0, IF(AND([Renewal Date]@row >= TODAY(0), [Renewal Date]@row <= TODAY(+30)), "Red", "Yellow"))

    I don't need the Green dot that you put at the beginning but I do see what you did. I didn't put in the alternate, if this meets the condition do X/if it doesn't meet the condition do Y. I missed the 'doesn't meet condition' part.

  • Pamela Wagner
    Pamela Wagner ✭✭✭✭✭✭

    Thanks also@Carson Penticuff! Your formula works as well and now I need to determine the difference! Always good to have options!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the公式手册模板!
You would use something along the lines of (Jan 2023):<\/p>

=COUNTIFS({Date Column}, AND(IFERROR(MONTH(@cell), 0) = 1<\/strong>, IFERROR(YEAR(@cell), 0) = 2023<\/strong>))<\/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":108911,"type":"question","name":"IF formula not working for a drop down list","excerpt":"Hello, I'm trying to equate a numerical value to a drop down list when I receive a form entry. Here is my list: 4 - very clear 3 - clear 2 - somewhat clear 1 - not clear The formula I entered was =IF([Training Objectives]@row = \"1 - not clear\", 1, IF([Training Objectives]@row = \"2 - somewhat clear\", 2, IF([Training…","snippet":"Hello, I'm trying to equate a numerical value to a drop down list when I receive a form entry. Here is my list: 4 - very clear 3 - clear 2 - somewhat clear 1 - not clear The…","categoryID":322,"dateInserted":"2023-08-14T14:32:56+00:00","dateUpdated":null,"dateLastComment":"2023-08-14T15:02:24+00:00","insertUserID":143464,"insertUser":{"userID":143464,"name":"Courtney M","url":"https:\/\/community.smartsheet.com\/profile\/Courtney%20M","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ZMErGR_kbWs!zDErcze5yPs!34pFnjKNrYv","dateLastActive":"2023-08-14T14:58:23+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":151203,"lastUser":{"userID":151203,"name":"Nick Korna","url":"https:\/\/community.smartsheet.com\/profile\/Nick%20Korna","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-14T15:32:48+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":27,"score":null,"hot":3384050720,"url":"https:\/\/community.smartsheet.com\/discussion\/108911\/if-formula-not-working-for-a-drop-down-list","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108911\/if-formula-not-working-for-a-drop-down-list","format":"Rich","lastPost":{"discussionID":108911,"commentID":390469,"name":"Re: IF formula not working for a drop down list","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/390469#Comment_390469","dateInserted":"2023-08-14T15:02:24+00:00","insertUserID":151203,"insertUser":{"userID":151203,"name":"Nick Korna","url":"https:\/\/community.smartsheet.com\/profile\/Nick%20Korna","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-14T15:32:48+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-14T15:25:45+00:00","dateAnswered":"2023-08-14T14:38:51+00:00","acceptedAnswers":[{"commentID":390454,"body":"

Hi @Courtney M<\/a>,<\/p>

It's an easy fix - you have an extra comma and bracket at the end of your formula. It should be:<\/p>

=IF([Training Objectives]@row = \"1 - not clear\", 1, IF([Training Objectives]@row = \"2 - somewhat clear\", 2, IF([Training Objectives]@row = \"3 - clear\", 3, IF([Training Objectives]@row = \"4 - very clear\", 4))))<\/p>

Hope this helps!<\/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":108901,"type":"question","name":"Unique codes","excerpt":"Hey all, I am trying to create a system that will check a unique code that is entered through a form and display if this code has been used already or not. I have a formula in the summary sheet that will asses if the code has been used or not: =VLOOKUP($Code$1, {Z Codes Trial Database Range 1}, 3, 0) The problem is that I…","snippet":"Hey all, I am trying to create a system that will check a unique code that is entered through a form and display if this code has been used already or not. I have a formula in the…","categoryID":322,"dateInserted":"2023-08-14T09:42:01+00:00","dateUpdated":null,"dateLastComment":"2023-08-14T14:37:37+00:00","insertUserID":160845,"insertUser":{"userID":160845,"name":"Itai","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Itai","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/3K032BZUIDXO\/nIVF32ENJD2KA.jpeg","dateLastActive":"2023-08-14T14:06:59+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"updateUserID":null,"lastUserID":45516,"lastUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-08-14T15:59:21+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":5,"countViews":46,"score":null,"hot":3384032978,"url":"https:\/\/community.smartsheet.com\/discussion\/108901\/unique-codes","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108901\/unique-codes","format":"Rich","tagIDs":[204,254],"lastPost":{"discussionID":108901,"commentID":390453,"name":"Re: Unique codes","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/390453#Comment_390453","dateInserted":"2023-08-14T14:37:37+00:00","insertUserID":45516,"insertUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-08-14T15:59:21+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,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/RGMU4LB8MFBS\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-14T12:23:27+00:00","dateAnswered":"2023-08-14T11:59:02+00:00","acceptedAnswers":[{"commentID":390433,"body":"

Try nesting in an INDEX function with a specified row of 1.<\/p>

=VLOOKUP(INDEX(Code:Code, 1)<\/strong>, {Cross Sheet Reference}, .......)<\/p>"},{"commentID":390435,"body":"

Try using INDEX(Code:Code, 1) instead of $Code$1<\/p>

Note: Also, I would recommend you use INDEX\/MATCH instead of VLOOKUP. Much more reliable.<\/p>


<\/p>

I hope this helps 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":[{"tagID":204,"urlcode":"Forms","name":"Forms"},{"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