Excel:如果单元格 1 包含 X 或 Y 或 Z,则单元格 2 应等于 W [英] Excel: if cell 1 contains X or Y or Z, then cell 2 should equal W

查看:43
本文介绍了Excel:如果单元格 1 包含 X 或 Y 或 Z,则单元格 2 应等于 W的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从标题来看,我需要 Excel 根据相应的 A 行单元格内容自动填充 B 行单元格.

As from the title, I need Excel to auto-populate the B row cells based on the corresponding A row cells content.

所以如果单元格 A1 包含 X 或 Y 或 Z,则单元格 B1 应等于 W,或者如果 A1 包含 G 或 H 或J,单元格 B1 应等于 W.

So if cell A1 contains X or Y or Z, then cell B1 should equal W, or if A1 contains G or H or J, cell B1 should equal W.

推荐答案

你可以试试把这个公式加到B1:

You can try adding this formula to B1:

=IF(OR(A1="X";A1="Y";A1="Z");"W";IF(OR(A1="G";A1="H";A1="J");"W";""))

第一部分检查 A1 是 XY 还是 Z.如果为真,则返回W",如果为假,则调用另一个 IF 语句,检查 A1 是否在 GH 或 J 中.如果为真,是的,再次W",如果不是,它只会在那里放任何东西.

The first part checks if A1 is either X Y or Z. If it's true, it returns "W", if it's false, it will call for another IF statement, that checks if A1 is in G H or J. If it's true, yes, "W" again, if it's not, it'll just put nothing in there.

可以通过仅使用一个 IF/OR 来简化它,如下所示:

It's possible to simplify it, by using only one IF/OR like this:

=IF(OR(A1="X";A1="Y";A1="Z";A1="G";A1="H";A1="J");"W";"")

根据您的区域设置,您可能需要将 ; 替换为 ,.

You might have to replace ; with , depending on your locale settings.

这篇关于Excel:如果单元格 1 包含 X 或 Y 或 Z,则单元格 2 应等于 W的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆