If cell and statement

2019-09-01 18:23发布

We are trying to use cell coloring in excel.

We would like that if a cell color is red it will give a numeric answer in another cell. For e.g. if cell A2 is red then in cell B2 it will be 8.

Does anyone knows how to do it without using VBA?

1条回答
劳资没心,怎么记你
2楼-- · 2019-09-01 18:43

There is no Excel worksheet function that can evaluate the colour of another cell.

Even if you invent a function and wing the syntax, it will not work.

The Cell() function has a "color" argument, but that does not identify the color. It returns 1 if the cell is formatted in color for negative values; otherwise returns 0 (zero).

https://support.office.com/en-us/article/cell-function-51bd39a5-f338-4dbe-a33f-955d67c2b2cf?NS=EXCEL&Version=16&SysLcid=1033&UiLcid=1033&AppVer=ZXL160&HelpId=xlmain11.chm60173&ui=en-US&rs=en-US&ad=US

So, what you want to achieve cannot be done without VBA.

You may want to shift your paradigm.

Instead of manually coloring a cell, use conditional formatting. The logic that is applied to arrive at the conditional format can be re-used to produce values in other cells of the spreadsheet.

查看更多
登录 后发表回答