Delimit Date/time in a match/index function
Hi all,
I'm using a match/index function currently to pull over data from another sheet.
Currently I'm using this:
=IFERROR(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), "")
The sheet I'm referencing in the function has time and date in the same column, so the above formula pulls over data that looks like this:2023-06-17T12:30:53-04:00
I'm hoping toonly pull over the date, not the time. I suspect the MID functionwould be appropriate to add into my formula, but I've never actually used it. Asking for help to see if this possible? if so, how would I add that into my current formula.
Apologies if I'm missing any necessary context.
Thank you!
Best Answers
-
Paul Newcome ✭✭✭✭✭✭
The DATEONLY function will not work because it was designed to pull the date out of something that is already stored as a date or date/time stamp on the back-end. The above data is a text string.
Try this instead:
=IFERROR(DATE(VALUE(LEFT(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 4)), VALUE(MID(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 6, 2)), VALUE(MID(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 9, 2))), "")
thinkspi.com
-
Paul Newcome ✭✭✭✭✭✭
What happens when you remove the VALUE from it?
=SUBSTITUTE(SUBSTITUTE([Column name]@row, "$", ""), "USD", "")
thinkspi.com
Answers
-
Carson Penticuff ✭✭✭✭✭
Will the date always be the first 10 characters? If so, you can use LEFT and specify the first 10 digits.
=IFERROR(LEFT(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 10), "")
-
murphyspccms ✭✭
@Carson Penticuffthat worked perfectly for my initial question, but now I'm wondering how to get what's pulled into a date format.
I have a function in a different column to calculate the date difference between 2 columns. I attached a screen shot, the 2nd row shows your response working as it should be.
-
Gia Thinh ✭✭✭✭✭
Hi murphyspccms ,
DATEONLY Function | Smartsheet Learning Center
I suggest using DATEONLY function to extract the date portion of a date/time value. You can add DATEONLY to your current formula as below:
=IFERROR(DATEONLY(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0))), "")
Hope that helps.
I love processes, worflows, automation, co-operation and technology. That's why I built a mini ERP solution for businesses.
-
murphyspccms ✭✭
@Gia Thinhis it possible to combine your function with@Carson Penticuff's function:
=IFERROR(LEFT(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 10), "")
I ask, because I didn't have luck with yours, the cell was blank. I'm wondering if it's because of the extra time info in the cell with the date.
-
Paul Newcome ✭✭✭✭✭✭
The DATEONLY function will not work because it was designed to pull the date out of something that is already stored as a date or date/time stamp on the back-end. The above data is a text string.
Try this instead:
=IFERROR(DATE(VALUE(LEFT(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 4)), VALUE(MID(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 6, 2)), VALUE(MID(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 9, 2))), "")
thinkspi.com
-
murphyspccms ✭✭
@Paul Newcomeamazing. This works. Thank you!
-
Paul Newcome ✭✭✭✭✭✭
-
murphyspccms ✭✭
hey@Paul Newcome, I'd like to use the formula you gave me but adjust it for another column that contains USD, but I'd like to only pull over the numbers that way I can use the column for basic math functions such as AVG.
I've been researching to see if there's a find and replace formula that'll automatically replace USD with blanks, but I don't think that's a viable option.
The problem that I anticipate with the formula that you made me, is the string of texts from the left aren't always going to be the same, the only common issue will be the USD on the end. Is there a "RIGHT" function?
I'm referring to this BTW from earlier:
=IFERROR(DATE(VALUE(LEFT(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 4)), VALUE(MID(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 6, 2)), VALUE(MID(INDEX({Google Sheets PTI Daily Form 6/19/23 Range 7}, MATCH([email protected], {claim num}, 0)), 9, 2))), "")
What are your thoughts? thank you so much for your help
-
Paul Newcome ✭✭✭✭✭✭
You would have to convert them into a numeric value on the source sheet. There is a RIGHT function, but we don't need it here. The below should work for stripping the $ and "USD" out and leave you with a numeric value.
=VALUE(SUBSTITUTE(SUBSTITUTE([Column name]@row, "$", ""), "USD", ""))
thinkspi.com
-
murphyspccms ✭✭
@Paul NewcomeI just tried this, but I'm getting an error. I have no idea how to troubleshoot this. Does the column properties need to be changed?
-
Paul Newcome ✭✭✭✭✭✭
What happens when you remove the VALUE from it?
=SUBSTITUTE(SUBSTITUTE([Column name]@row, "$", ""), "USD", "")
thinkspi.com
-
murphyspccms ✭✭
@Paul NewcomeI think that's it. Thank you!!
Help Article Resources
Categories
Double check your cross sheet references. Make sure they are all single columns by clicking on the appropriate column header.<\/p>
<\/p>
When doing this, give the sheet a little time to load before selecting the column. Sometimes moving too fast allows you to select a column header before the sheet fully loads in the creator window. Then when the sheet does finally completely load in, the selection automatically reverts to the home cell (top right corner). This happens to me quite a bit when I am in a hurry.<\/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":106940,"type":"question","name":"IF cell CONTAINS one\/two\/three different values, return corresponding values","excerpt":"Hello community, I am attempting to return single or multiple values depending on a multiple dropdown column. My dropdown column contains criteria \"Consolidation\", \"Reduction\", \"Termination\", \"New\" Currently the formula works for single values with the following formula =IF([Type of Project]@row = \"Consolidation\", \"🝢\",…","snippet":"Hello community, I am attempting to return single or multiple values depending on a multiple dropdown column. My dropdown column contains criteria \"Consolidation\", \"Reduction\",…","categoryID":322,"dateInserted":"2023-06-27T09:24:42+00:00","dateUpdated":null,"dateLastComment":"2023-06-27T12:11:45+00:00","insertUserID":143463,"insertUser":{"userID":143463,"name":"Sam Swain","url":"https:\/\/community.smartsheet.com\/profile\/Sam%20Swain","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-27T20:08:44+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-06-27T12:11:22+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":53,"score":null,"hot":3375727587,"url":"https:\/\/community.smartsheet.com\/discussion\/106940\/if-cell-contains-one-two-three-different-values-return-corresponding-values","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106940\/if-cell-contains-one-two-three-different-values-return-corresponding-values","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":106940,"commentID":382505,"name":"Re: IF cell CONTAINS one\/two\/three different values, return corresponding values","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/382505#Comment_382505","dateInserted":"2023-06-27T12:11:45+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-06-27T12:11:22+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"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\/Q6RJIERQGF1Y\/screenshot-2023-06-27-at-10-22-29.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"Screenshot 2023-06-27 at 10.22.29.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-27T10:17:00+00:00","dateAnswered":"2023-06-27T10:12:21+00:00","acceptedAnswers":[{"commentID":382490,"body":"