如何逻辑测试Excel中另一个单元格的格式

She*_*ord 3 macos excel

我知道条件格式。我想从相反的方向进行测试。

为了简化,我基本上想这样做:

if ((Text_Align(A1)='left',"L","R")  
Run Code Online (Sandbox Code Playgroud)

或者

if ((Background_Color(A1)="Pink", "Red dominates the background", "Just another blah background")

if ((Fontweight(A1)="Bold", "That was a strong statement", "A cell filled by a bean counter")
Run Code Online (Sandbox Code Playgroud)

到目前为止,我还没有找到一个函数可以完成与 Text_Align 相同的功能——即测试单元格格式的值。

这可能吗?

Chr*_*ser 5

您可以使用 CELL 函数获取有关单元格格式等的一些信息,例如:

=CELL("format", H2)
Run Code Online (Sandbox Code Playgroud)

这支持许多其他参数,而不是此处定义的格式。

但是,如果此函数的选项没有返回您需要的内容,那么您可能需要按照 Bathsheba 的答案中的建议使用 VBA。