Nested VLOOKUP statement error
I am receiving an error with the following nested VLOOKUP statement. I've included an image that might help to better explain. Unfortunately, I have looked at this so many times and tried so many combinations that I'm afraid it is a simple fix that I am just not seeing.
Need to use the number in Details4 cell (in this case ProjectId=1) to look up on the Intake Form sheet for the Row with Project ID = 1, then go to column 50 (which is a checkbox). If the checkbox is checked then the Status field needs to say "Complete" otherwise it can say "In Queue"
Best Answers
-
Paul Newcome ✭✭✭✭✭✭
Try something like this instead...
=IF(INDEX({Other Sheet Checkbox Column}, MATCH(Details4, {Other Sheet Project ID Column}, 0)) = 1, "Complete")
This section:
INDEX({Other Sheet Checkbox Column}, MATCH(Details4, {Other Sheet Project ID Column}, 0))
will basically pull whether or not the box is checked in whatever row the project id is found on.
Then we drop that in an IF statement to say that if the result of the INDEX/MATCH equals 1 (the box is checked) then output "Complete".
-
Paul Newcome ✭✭✭✭✭✭
The difference between yours and mine is that I did not specify a column number. That is why there are two closing parenthesis at the end of mine. One to close the MATCH then another to close the INDEX.
Because you are specifying a column number, You will want to close the MATCH with one closing parenthesis, then continue your INDEX statement from there.
=INDEX(range, row #, Column #)
You will want to close the MATCH and drop it into the row # portion.
=INDEX(range, MATCH(.......), Column #)
Just a note... Because you only need to return data from one column, you can reference only that one column in your Range 5 and skip over the column number in the INDEX function. That's one of the many perks to using INDEX/MATCH. The columns referenced can be completely independent on each other.
To fix your formula:
=INDEX({Project Team Range 5}, MATCH([Responsible Dept]27, {Project Team Range 3}, 0), 2)
To maximize flexibility taking advantage of the ability to reference independent columns...
=INDEX({Project Team Name Column Only}, MATCH([Responsible Dept]27, {Project Team Range 3}, 0))
A couple of notes:
- In both of the final formulas, there are only 2 closing parenthesis. That is because we are only using 2 functions. A third closing parenthesis anywhere without a matching opening parenthesis will always cause an issue.
- Note the lack of a column number in my formula. Selecting only the column we are pulling from for the range in the INDEX function means that the source sheet can now be reorganized in regards to the column positions however you want as many times as you want without breaking anything. Referencing two columns for the INDEX range means that those two columns MUST ALWAYS remain adjacent and in that specific order which completely negates the flexibility of this combo.
Answers
-
Paul Newcome ✭✭✭✭✭✭
Try something like this instead...
=IF(INDEX({Other Sheet Checkbox Column}, MATCH(Details4, {Other Sheet Project ID Column}, 0)) = 1, "Complete")
This section:
INDEX({Other Sheet Checkbox Column}, MATCH(Details4, {Other Sheet Project ID Column}, 0))
will basically pull whether or not the box is checked in whatever row the project id is found on.
Then we drop that in an IF statement to say that if the result of the INDEX/MATCH equals 1 (the box is checked) then output "Complete".
-
Sarah Brelage ✭✭✭✭✭
Awesome. It worked like a charm. I had was going back and forth about possibly using the INDEX but haven't used it much so I dismissed it quickly. Thanks for the help!!
-
Paul Newcome ✭✭✭✭✭✭
Happy to help!️
老实说……我没有使用VLOOKUP很长time. INDEX/MATCH is SO much more flexible as it allows for reorganization of the source sheet without breaking the formula because you can reference each column individually. It also means that the order of the columns doesn't matter so you don't have to worry about which one is on the right or left.
Here's a breakdown of how it works...
=INDEX(range to pull from, row number, optional column number)
The range to pull from is the obvious part. That is the data you want to pull.
The second portion where you specify the row number is where MATCH comes into play.
MATCH will return a numerical value based on which cell within a range specific data is found. When referencing an entire column, the returned value becomes the row number.
=MATCH(data to search for, range to search in, match type)
I have found that using 0 (zero) for the match type provides the most consistently accurate results.
So if you are only looking at one column to pull data from and one column to match on, you would build the MATCH formula and just drop it into the second portion of the INDEX function.
You can also use a second MATCH function in the third portion of the INDEX function if you are pulling from a table so that row and column numbers are both automated based on your specified criteria.
I definitely strongly recommend familiarizing yourself with the INDEX/MATCH combo in place of the VLOOKUP as it provides a lot more flexibility and will make things easier in the long run.
(SIDE NOTE: The COLLECT function also brings a huge level of flexibility once you get the hang of it. You can essentially use this to turn any function into afunctionIF kind of thing.)
-
Sarah Brelage ✭✭✭✭✭
=INDEX({Project Team Range 5}, MATCH([Responsible Dept]27, {Project Team Range 3}, 0)), 2)
So here is the one I'm trying on my own...Project Team Range 5 is made up of two columns, Role and Name. Responsible Dept is the Role in my sheet. Project Team Range 3 is one column and it contains the many options to match with Responsible Dept. The 2 was referencing the second column in Project Team Range 5 contains the Name that needs to be returned.
It keeps giving me an error and I've been through this several times and I matched your example etc. so I'm not stuck
-
Paul Newcome ✭✭✭✭✭✭
The difference between yours and mine is that I did not specify a column number. That is why there are two closing parenthesis at the end of mine. One to close the MATCH then another to close the INDEX.
Because you are specifying a column number, You will want to close the MATCH with one closing parenthesis, then continue your INDEX statement from there.
=INDEX(range, row #, Column #)
You will want to close the MATCH and drop it into the row # portion.
=INDEX(range, MATCH(.......), Column #)
Just a note... Because you only need to return data from one column, you can reference only that one column in your Range 5 and skip over the column number in the INDEX function. That's one of the many perks to using INDEX/MATCH. The columns referenced can be completely independent on each other.
To fix your formula:
=INDEX({Project Team Range 5}, MATCH([Responsible Dept]27, {Project Team Range 3}, 0), 2)
To maximize flexibility taking advantage of the ability to reference independent columns...
=INDEX({Project Team Name Column Only}, MATCH([Responsible Dept]27, {Project Team Range 3}, 0))
A couple of notes:
- In both of the final formulas, there are only 2 closing parenthesis. That is because we are only using 2 functions. A third closing parenthesis anywhere without a matching opening parenthesis will always cause an issue.
- Note the lack of a column number in my formula. Selecting only the column we are pulling from for the range in the INDEX function means that the source sheet can now be reorganized in regards to the column positions however you want as many times as you want without breaking anything. Referencing two columns for the INDEX range means that those two columns MUST ALWAYS remain adjacent and in that specific order which completely negates the flexibility of this combo.
-
Sarah Brelage ✭✭✭✭✭
Thanks. That worked perfectly and I appreciate the explanation!!
-
Paul Newcome ✭✭✭✭✭✭
Help Article Resources
Categories
Check out theFormula Handbook template!
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-26T01:04:51+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":22,"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-26T01:04:51+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":23,"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":"