简体   繁体   English

Excel-将2个单元格合并为一个单元格的公式,但一个单元格采用日期格式

[英]Excel - Formula to join 2 cells into one, but one is in date format

In my Excel there are 2 columns with data values. 在我的Excel中,有2列带有数据值。 One have date and another have a string of numbers. 一个有日期,另一个有一串数字。

| 2019-01-25 | 114589 |

In the next column, I have a formula which will join the 2 together. 在下一列中,我有一个公式,它将2结合在一起。

Formula:
    =C2&", "&D2

What I expected:
| 2019-01-25, 114589 |

What I got:
| 43490, 114589 |

This formula worked fine if both columns were using text and numbers. 如果两个列都使用文本和数字,则此公式效果很好。 But now that date is involved, it cannot work and the date reverts to number format, even when the cell format is set to date. 但是现在涉及到日期了,即使单元格格式设置为日期,日期也无法使用,并且日期会恢复为数字格式。 How to tell the cell to give me my data as a string? 如何告诉单元格将我的数据作为字符串提供给我?

尝试:

=TEXT(C2,"yyyy-mm-dd, ")&D2

您可以尝试:

=TEXT(C2,"yyyy-mm-dd") & " " & D2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Excel公式适用于一种时间格式,不适用于另一种时间格式 - Excel formula is working for one format of time not for another Excel 公式将一个公式应用于引用调用和上面的单元格,将另一个公式应用于下面的单元格 - Excel Formula to apply one formula to reference call and cells above and another formula to cells below 一个公式中的Excel日期函数和时间函数 - Excel Date function and Time function in one formula 在公式中将日期增加一天 - Excel - Increment Date by One Day in Formula - Excel Excel如何在列的所有单元格中替换公式的一部分 - Excel How to replace one part of a Formula in all the cells in a Column Excel 将多个单元格组合成一个数组作为公式中的变量输入 - Excel combine multiple cells into one array as a variable input in a formula Excel:仅根据一个单元格的值或公式填充一系列单元格 - Excel: Fill a range of cells with a value or formula depending on only one cell 通过两个单元格创建日期-在Excel中一个带有日期,另一个带有小时 - Create date by two cells - one with date and other with hour in Excel excel公式以特定格式将2个单元格合并为1个 - excel formula to combine 2 cells into 1 in specific format Excel公式可将一个表中的单元格与另一表中的单元格进行匹配,并返回求和值 - Excel formula to match cells from one table to cells from another table and return summed values
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM