英文:
Is there a way to quickly check what attribute the data is in a cell in a spreadsheet?
问题
我知道我们可以轻松地转换或更改单元格中的数据属性,并且有快捷方式可供使用,但是否有一种方法可以检查列中的数据或数据列表是否保存为int/string/date等?
我想要能够快速检查列中的数据是否以正确的格式/属性保存,而不必再次进行转换/更改以确保。
英文:
I know we can easily convert or change the attribute to of data in a cell quickly and there are shortcuts for it but is there a way to check if a data or list of data in a column is saved as an int/string/date/etc?
I would like to be able to just quickly check if the data I have in a column is saved in the correct format/attribute without having to convert/change it again just to make sure.
答案1
得分: 0
Excel会自动做出关于数据的假设。与Python或其他编程语言不同,Excel没有数据类型。可以使用函数来测试单元格的值。
可以使用以下函数来查看数据类型:
ISTEXT()
:文本ISBLANK()
:空白ISNUMBER()
:数字ISLOGICAL()
:布尔值ISERR()
:错误
如果你想知道B5单元格的数据类型,可以使用以下公式:
=IFS(ISTEXT(B5),"文本",ISBLANK(B5),"空白",ISNUMBER(B5),"数字",ISLOGICAL(B5),"布尔值",ISERR(B5),"错误")
要将数字转换为字符串,在数字前加上单引号,例如 '50
。在Excel中,日期也是一个数字。要将存储为字符串的数字转换为数字,可以乘以1。
此外,还有一个函数CELL()
,可以用来查看单元格的格式,如下所示:
=CELL("format", B5)
你可以在此处查看有关该函数的详细信息:CELL函数详细信息。
英文:
Excel will make assumptions of what the data is automatically. There is no datatype like in python or other coding languages. There are functions for testing cells values.
Functions to look at istext(), isblank(), isnumber(), islogical(), iserr(), ...
so if you want to know the data type in B5.
=IFS(ISTEXT(B5),"String",ISBLANK(B5),"Null",ISNUMBER(B5),"Number",ISLOGICAL(B5),"Boolean",ISERR(B5),"Error")
To convert a number to a string use the single quote mark prior to the number like '50
. A date in excel is also a number. To convert a number stored as a string into a number multiply by 1.
Edit---
There is a fuction =Cell() see the details here
=CELL("format",B5)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论