简体   繁体   中英

How do I concatenate a date cell (independant of locale) to a string in Excel?

I have a date cell 2020-02-21.

In my mind CONCAT(A1," my date") should procude the expected string "2020-02-21 my date".

But no, Excel decides to treat is as a date and convert it to a mumbojumbo number resulting in the output "438562 my date". This would be logical if the cell value was formatted as date, but it's a TEXT field (!!).

So now you're probably going to point me to the millions of threads on this site that tell me to use the TEXT function. But here's the deal. The second argument of TEXT expects a format such as "YYYY-mm-dd" which is going to be LOCALE SPECIFIC . If I hardcode a format, the file won't work when I pass it to my collegue in spain, or whatever.

It works if I use "ÅÅÅÅ-MM-dd" but that's specific only to Sweden. I've tried the [$-xxx] codes in front of the fromat, but to no avail.

Is there a way to format the date in "YYYY-MM-DD" format without excel caring about the langauge or locale you are using?

Getting utterly frustrated that such a simple task cannot be done easily. Please help!

怎么样: =CONCATENATE(YEAR(A1),"-",MONTH(A1),"-",DAY(A1)," my date")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM