Using IF/AND with two ranges of data.

I have been working on the following problem for a couple of days, but I have not been able to get anything even remotely correct to work as desired. I can only get anything to execute if I tie the two lookup cells to row #.

=IF(AND(Adresses@row = Streets1, Include1 = "Yes"), "Yes","No")

That is obvious not what I want!

Hope someone can help.

The actual project has 2 sheets with many columns, but this task only uses 4 columns.

So, for testing purposes I combined all the 4 columns involved in this task into one sheet..

See the screen print!

任务是使用“地址”列检查我f that particular street is assigned to be part of a mailing list as indicated in the “Streets” and “Include” column.

It should print a “Yes or “No” in the Mailing list column.

The sheet already contains a Help Column used by another Formula – I don’t know if that is helpful for this.

Note 2:

The preferred solution would be to replace the Yes/No columns with Checkbox column, but I don’t think that is possible – I don’t see any sample how to set the checkbox based on another checkbox.

Screen Shot 10-03-23 at 11.14 AM.JPG

Kurt

Best Answer

  • Teamciccone30576
    Teamciccone30576 ✭✭✭
    Answer ✓

    @Joe Calderazzo

    I guess you helped me with the checkbox question as well.

    I used the exact same formular on the sheet, now with Checkbox columns, and it works perfectly.

    And when I change the “Include” column selection, it changes the “Mailing list" instantly.

    Exactly as I wanted it to work.

    I cannot thank you enough for getting me on the right course with this.

Answers

  • =IF(AND(Addresses@row = [Streets]@row, [Include]@row = "Yes"), "Yes", "No")

  • @Joe Calderazzo

    Thanks for looking at this, but this just move down the Streets column.

    The sample have 3 ALICE LN's in the "Adresses" column - all 3 should be evaluated against the list of streets and should find that ALICE LN in "Adresses" column is = ALICE LN in the "Street" column and find it has a "Yes" and therefore should be included and should produce a "Yes" in the mailing List.

    (I knew, I should have corrected the spelling before I posted)

  • OK, thank you for the clarification. What you are in need of is an Index/Match to return the yes/no that already exists in the Include column...

    This is what that would look like:

    In the the Mailing List column, enter the below

    =INDEX(Include:Include, MATCH(Addresses@row, Streets:Streets))

    Make this a Column Formula

    If the Streets and Include columns are on separate sheet, in this case named Sheets 1, then the formula looks like this - renaming the column reference to Sheet 1_Streets and Sheet 1_Include accordingly.

    =INDEX({Sheet 1_Include}, MATCH(Addresses@row, {Sheet 1_Streets}))

    Let me know if this works for you and is what you are looking for.

    Below are the results of both of these set as Column Formulas.

    image.png


  • @Joe Calderazzo

    F A N T A S T I C

    This work as advertised.

    On the single sheet it works directly.

    Changing the test sheet to a 2 Sheet solution, I was not able to use the Formula you quoted – I probably messed it up somehow.

    I used the “Edit References” pop up to get the references in – and it worked Perfect.

    · =INDEX({Sheet 1 Range 1},MATCH(Addresses@row, {Sheet 1 Range 2}))

    I presume the way you quoted, is just another way to do the same thing – I just did not get it right.

    I incorporated the formula in the actual project – 4,000 addresses, 300 street and 11 Mailing lists – and it works beautiful. (Just did one Mailing list for now)

    So many thanks for this– I would never have found it by myself.

    I presume we cannot use Check boxes “Checked” or “Unchecked” instead of the “Yes” or “No” column? I have not seen any samples of a checkbox been set by another check box.

    Kurt

  • Yes, you can use checkboxes to check other checkboxes. What are you looking to do with the checkboxes?

  • @Joe Calderazzo

    In the current project, replace the "Include" and the "Mailing List" checkboxes

    Screen Shot 10-04-23 at 04.32 PM.JPG

    Kurt

  • @Joe Calderazzo

    I should clarify my last post!

    If an “Include” check box isnotchecked for a street in the “Streets” column and “Mailing List” check box is checked previous version, the formular need to uncheck that check mark.

    Mailing list changes now and then.


    Kurt

  • Teamciccone30576
    Teamciccone30576 ✭✭✭
    Answer ✓

    @Joe Calderazzo

    I guess you helped me with the checkbox question as well.

    I used the exact same formular on the sheet, now with Checkbox columns, and it works perfectly.

    And when I change the “Include” column selection, it changes the “Mailing list" instantly.

    Exactly as I wanted it to work.

    I cannot thank you enough for getting me on the right course with this.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out theFormula Handbook template!
Hi @Heather P.<\/a>,<\/p>

Try this:<\/p>

=RIGHT((LEFT([Max Date]@row, 6)), 2) + \"\/\" + RIGHT([Max Date]@row, 2) + \"\/\" + LEFT([Max Date]@row, 4)<\/p>

I tested and here are the results: <\/p>

\n
\n \n \"image.png\"<\/img><\/a>\n <\/div>\n<\/div>\n


<\/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":111244,"type":"question","name":"Help with nested if and statements","excerpt":"I have an assessment with different factors to create a final score. There are four individual results that factor in. First determines critical vs non-critical. If \"Critical\" and any of four individual scores are \"No\" then 0 pts, if \"Yes\" then 4 pts, if \"Non-Critical\" and 1 of the four individual scores are \"No\" then…","snippet":"I have an assessment with different factors to create a final score. There are four individual results that factor in. First determines critical vs non-critical. If \"Critical\" and…","categoryID":322,"dateInserted":"2023-10-05T12:23:49+00:00","dateUpdated":"2023-10-05T12:50:52+00:00","dateLastComment":"2023-10-05T15:50:56+00:00","insertUserID":131807,"insertUser":{"userID":131807,"name":"Lara Kelly","url":"https:\/\/community.smartsheet.com\/profile\/Lara%20Kelly","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!e5DE50spI1Q!nPHBH51xhnw!D2j2PsO7E0a","dateLastActive":"2023-10-05T16:04:12+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":131807,"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-10-05T16:00:46+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":31,"score":null,"hot":3393031485,"url":"https:\/\/community.smartsheet.com\/discussion\/111244\/help-with-nested-if-and-statements","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/111244\/help-with-nested-if-and-statements","format":"Rich","lastPost":{"discussionID":111244,"commentID":398652,"name":"Re: Help with nested if and statements","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/398652#Comment_398652","dateInserted":"2023-10-05T15:50:56+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-10-05T16:00:46+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\/YKS5MT5IMMBD\/image.png","urlSrcSet":{"10":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=10\/https:\/\/us.v-cdn.net\/6031209\/uploads\/YKS5MT5IMMBD\/image.png","300":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=300\/https:\/\/us.v-cdn.net\/6031209\/uploads\/YKS5MT5IMMBD\/image.png","800":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=800\/https:\/\/us.v-cdn.net\/6031209\/uploads\/YKS5MT5IMMBD\/image.png","1200":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1200\/https:\/\/us.v-cdn.net\/6031209\/uploads\/YKS5MT5IMMBD\/image.png","1600":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1600\/https:\/\/us.v-cdn.net\/6031209\/uploads\/YKS5MT5IMMBD\/image.png"},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-10-05T15:46:54+00:00","dateAnswered":"2023-10-05T13:24:08+00:00","acceptedAnswers":[{"commentID":398577,"body":"

Hi @Lara Kelly<\/a>,<\/p>

I think this is what you're after:<\/p>

=IF(OR(AND([Critical\/Non-Critical]@row = \"Critical\", COUNTIF([Result-1]@row:[Result-4]@row, \"Yes\") >= 1, COUNTIF([Result-1]@row:[Result-4]@row, \"No\") = 0), AND([Critical\/Non-Critical]@row = \"Non-Critical\", COUNTIF([Result-1]@row:[Result-4]@row, \"Yes\") = 4)), 4, IF(AND([Critical\/Non-Critical]@row = \"Non-Critical\", COUNTIF([Result-1]@row:[Result-4]@row, \"No\") = 1), 2, 0))<\/p>

Sample output:<\/p>

\n
\n \n \"image.png\"<\/img><\/a>\n <\/div>\n<\/div>\n

The position of a Yes\/No\/blank won't matter due to using COUNTIF.<\/p>

If I've misunderstood one of the criteria or you've any problems\/questions then please advise. 🙂<\/span><\/p>"},{"commentID":398650,"body":"

@Nick Korna<\/a> Thank you! This works.<\/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":111207,"type":"question","name":"Vlookup Error","excerpt":"Trying to create a vlookup that will check for a circuit on the first sheet and return the site code from the second sheet, but I keep getting the Invalid Data Type error. =VLOOKUP(Circuit@row, {Site Bandwidth Range Circuit}, {Site Bandwidth Range Site Code}, false) Lookup Sheet What silly thing am I doing wrong?","snippet":"Trying to create a vlookup that will check for a circuit on the first sheet and return the site code from the second sheet, but I keep getting the Invalid Data Type error.…","categoryID":322,"dateInserted":"2023-10-04T18:49:32+00:00","dateUpdated":null,"dateLastComment":"2023-10-05T14:48:15+00:00","insertUserID":167683,"insertUser":{"userID":167683,"name":"aurea","title":"Program Manager","url":"https:\/\/community.smartsheet.com\/profile\/aurea","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-05T12:22:15+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-10-05T14:56:26+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":25,"score":null,"hot":3392964467,"url":"https:\/\/community.smartsheet.com\/discussion\/111207\/vlookup-error","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/111207\/vlookup-error","format":"Rich","lastPost":{"discussionID":111207,"commentID":398615,"name":"Re: Vlookup Error","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/398615#Comment_398615","dateInserted":"2023-10-05T14:48:15+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-10-05T14:56:26+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\/D7A3DDIT0JLL\/image.png","urlSrcSet":{"10":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=10\/https:\/\/us.v-cdn.net\/6031209\/uploads\/D7A3DDIT0JLL\/image.png","300":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=300\/https:\/\/us.v-cdn.net\/6031209\/uploads\/D7A3DDIT0JLL\/image.png","800":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=800\/https:\/\/us.v-cdn.net\/6031209\/uploads\/D7A3DDIT0JLL\/image.png","1200":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1200\/https:\/\/us.v-cdn.net\/6031209\/uploads\/D7A3DDIT0JLL\/image.png","1600":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1600\/https:\/\/us.v-cdn.net\/6031209\/uploads\/D7A3DDIT0JLL\/image.png"},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-10-05T12:47:26+00:00","dateAnswered":"2023-10-04T23:16:50+00:00","acceptedAnswers":[{"commentID":398510,"body":"

Try an INDEX\/MATCH instead.<\/p>

=IFERROR(INDEX({Site Code}, MATCH(Circuit@row, {Circuit}, 0)), \"//www.santa-greenland.com/community/discussion/111135/\")<\/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":[]}],"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