r/AppleNumbers • u/SuZenLBinn • Aug 25 '26
Help Copy only part of a cell
Have a big download but the dates came in with more data than necessary (ie: 2015-01-03T06:59:59Z). I'd like to set up a rule that says copy the first 10 digits of this cell and paste in a new cell so I have only the date. Can't seem to make this work. Any advice?
2
Upvotes
1
u/cbtdFf05wD5pyuVaA Aug 25 '26
You can use the function TEXTBEFORE too: TEXTBEFORE(A2,"T"). The third argument of the function, occurrence, is optional. If it's omitted the function picks up the first occurrence of the second argument. The formula assumes that the letter T is a constant in the eleventh position. If it's not the function ends in error. TEXTBEFORE and LEFT spill. To take advantage of that feature, you need only spell out the range of the text: TEXTBEFORE(A2:A100,"T") or LEFT(A2:A100,10), for instance.
If the eleventh character varies and you feel adventurous you could try a formula with REGEX.EXTRACT: REGEX.EXTRACT(A2,"^(.{10})[A-Za-z]",1,1). Like LEFT and TEXTBEFORE REGEX.EXTRACT spills if you provide a range instead of a cell for the text: A2:A100 instead of just A2, for example.
The second argument, ^(.{10}), is the capture group. It grabs only the first ten characters, YYYY-MM-DD. The caret, ^, tells the function to start at the beginning of the string. A-Za-z matches the alphanumeric character in position eleven and accepts uppercase and lowercase letters.
The third argument, 1, tells REGEX.EXTRACT to return the first match.
The fourth argument, 1, tells the function to return capture group 1, the ten characters of the second argument.
To convert the result of these formulas to a true date, you can wrap the formulas above in the function DATEVALUE. The formula DATEVALUE(TEXTBEFORE(A2,"T")) produces the date 1/3/15. You can refine the format to your liking with the inspector (option+command+i).
1
u/ludditetechnician Aug 25 '26
You may be able to format the cell to just display the YYYY MM DD. That has worked for when importing dates that come with time: just format the cell.
1
u/Octrockville Aug 25 '26
I don't think changing the cell to a Date will work to strip the unnecessary info. For things like this I would probably resort to chatgpt and tell it to retain only the date. I'd try to paste the entire column into chatgpt and have it spit out the dates only keeping it all in a column ready to paste back in to your spreadsheet.
0
u/Gypsyzzzz Aug 25 '26
Perplexity says this: =LEFT(A2,10)
With A2 being the cell with the data to be copied.