VLOOKUP for a date within a referenced row of matching username
Hi,
I am building a sheet that references a larger sheet of user activity. There are two sheets are play. Sheet A is the main database and Sheet B is a culmination of data, soon to shoot off into reports of its own.
Sheet A has two columns which include parent and child rows.
Sheet A Column 1 is named originalUsernames. It contains usernames manually inserted. Each unique username is a parent row. The child rows repeat the username featured in the parent rows' originalUsernames column.
Sheet A Column 2 is called "Job End Date" and contains dates. The child rows within this column contain different dates to represent different "Job End Dates" for the same user presented in the child rows.
This is where it gets tricky.
In Sheet B Column 1, I am pushing data from an alternate source via API with usernames that match the originalUsernames found in Sheet A Column 1.
Sheet B Column 1 is called userName
To match up my originalUsernames from Sheet A Column 1 with Sheet B Column 1, I use the column formula in Sheet B Column 2 below:
=IFERROR(VLOOKUP(userName@row, {originaluserName}, 1, false), "No username")
This part works great, and usernames from each sheet line up on their respective rows, showcasing the error "No username" as intended if no username is present in Sheet A Column 1.
Now, in Sheet B Column 3 I need to pull in the Job End Date the most in the future from Sheet A Column 2, all while matching up with the appropriate rows present.
I tried referencing the Job End Date column in Sheet A Column 2, and building a similar VLOOKUP, but it is just giving me the error of "No dates", but there are dates present, and many.
=IFERROR(VLOOKUP(userName@row, {JobEndDate}, 1, false), "No dates")
I am also missing the part for searching for the most future date within the child rows of each username.
Thank you for your insight on next steps.
Best Answer
-
Paul Newcome ✭✭✭✭✭✭
You need a MAX/COLLECT combo instead of those IFs.
=MAX(COLLECT({Date Column}, {User Column}, @cell = userName@row))
Answers
-
vwphoto ✭
I want to also skip any non-dates or blank values listed in the job end date column of Sheet A
=IFERROR(MAX(IF(ISDATE({JobEndDate}), IF({originaluserName} = userName@row, {JobEndDate}, 0))), "No dates")
I think its something in this range but getting a #INCORRECT ARGUMENT SET - would appreciate any feedback
---
I also tried:
=IFERROR(MAX(COLLECT({JobEndDate}, {AD userName}, userName@row)), "No dates")
I cleared all non-dates and made sure it was either dates or blank fields in the JobEndDate column, but received a #INVALID COLUMN VALUE error for one user, and "0" for other users
If a user with a parent row and child has all dates filled in, then I receive a #INVALID COLUMN VALUE. If a date is missing in the parent row cell of Job End Date, then it results in "0".
Do I need a separate column in Sheet A that pulls the oldest date listed within a user's child rows? And then have my separate Sheet B reference this cell for each user?
-
vwphoto ✭
Update: I had to change the Column type to "date" and that resolved the issue of INVALID COLUMN VALUE
I now see the date I wanted in relation to the user.
-
vwphoto ✭
The only issue that remains now is that it is not picking the most future set date "latest date" as per MAX, it is just pulling the date within the parent row, even if there is a more future set date / later date in the child rows.
Thoughts?
-
Paul Newcome ✭✭✭✭✭✭
You need a MAX/COLLECT combo instead of those IFs.
=MAX(COLLECT({Date Column}, {User Column}, @cell = userName@row))
-
vwphoto ✭
Thanks@Paul Newcome- The formula works and pulls the latest date, although only if every child row in Sheet A lists the userName. Is there anyway to have it detect a value in the parent row only, and then scan through all child rows within that parent?
Or is that userName value present in every child row the only way for the formula to understand the request of pulling every related job end date for the child rows of said user?
-
Paul Newcome ✭✭✭✭✭✭
它将会出现在每一行。如果你基于“增大化现实”技术e worried about keeping the sheet clean, you can use a helper column to pull the user name into every row based on the parent cell, hide the column, then reference this helper column in your MAX/COLLECT.
-
vwphoto ✭
Yes, the concern is more about reducing data entry. If there is 5 to 10 child rows per parent/user, we would want the child rows to auto-popuplate with the parent rows username value.
So you would create a new column with a column formula that pulls the username based on the parent cell, and then this would fill the child rows?
Could you provide an example please@Paul Newcome?
-
Paul Newcome ✭✭✭✭✭✭
The formula in the helper column would be:
=PARENT(userName@row)
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-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":"