gpt4 book ai didi

Keeping M/D date format when a cell is included in a string(单元格包含在字符串中时保留M/D日期格式)

转载 作者:bug小助手 更新时间:2023-10-24 17:55:05 40 4
gpt4 key购买 nike



I have dates in Col A.

Col B ="I23-"&A2&"-"

我在A列有日期。B列=“I23-”&A2&“-”


A2 is 8/3 but
B2 output is I23-45141-

A2为8/3,但B2输出为I23-45141-


I tried using ="I23-"&TO_DATE(A2)&"-" and I still get the same output no matter what.
How do I keep the date in it's original format when used in a string to get Col B value?

我尝试使用=“i23-”&to_date(A2)&“-”,但无论如何都会得到相同的输出。在字符串中使用日期以获取列B值时,如何保持日期的原始格式?


更多回答

So far my solution is to create another Col that uses "=if(isblank(A2)=FALSE,Left(A2,3),)" to get it out of it's original date format and then that seems to work

到目前为止,我的解决方案是创建另一个Col,使用“=if(isblank(A2)= left(A2,3),)”将其从原始日期格式中删除,然后似乎可以工作

45141 is nothing but value of date 8/3/2023. So, you have to use some date conversion function like TEXT(). Try ="I23-"& TEXT(A2,"m/d")&"-"

45141只是日期为2023年8月3日的值。因此,您必须使用一些日期转换函数,如Text()。Try=“i23-”&Text(A2,“m/d”)&“-”

优秀答案推荐

You can use TEXT choosing the format you need, as Harun suggested, or you can try with TO_TEXT, which should present the information in the cell as it was originally presented:

您可以使用文本来选择所需的格式,正如Harun建议的那样,或者您也可以尝试使用TO_TEXT,它将在单元格中显示最初显示的信息:


="I23-"&TO_TEXT(A2)&"-"

更多回答

Thanks :) . I figured TO_DATE would work better than TO_TEXT

谢谢:)。我认为To_Date比To_Text更有效

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com