简体   繁体   English

Excel:如果单元格 1 包含 X 或 Y 或 Z,则单元格 2 应等于 W

[英]Excel: if cell 1 contains X or Y or Z, then cell 2 should equal W

As from the title, I need Excel to auto-populate the B row cells based on the corresponding A row cells content.如标题所示,我需要 Excel 根据相应的 A 行单元格内容自动填充 B 行单元格。

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.因此,如果单元格A1包含 X 或 Y 或 Z,则单元格B1应等于 W,或者如果A1包含 G、H 或 J,则单元格B1应等于 W。

You can try adding this formula to B1:您可以尝试将此公式添加到 B1:

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

The first part checks if A1 is either XY 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 GH or J. If it's true, yes, "W" again, if it's not, it'll just put nothing in there.第一部分检查 A1 是 XY 还是 Z。如果是真的,它返回“W”,如果是假的,它会调用另一个 IF 语句,检查 A1 是在 GH 还是 J。如果是真的,是的,再次“W”,如果不是,它只会在其中放置任何内容。

It's possible to simplify it, by using only one IF/OR like this:可以通过只使用一个 IF/OR 来简化它,如下所示:

=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. ,具体取决于您的语言环境设置。

如果要将比较值硬编码到公式中,可以像这样收紧。

=IF(OR(A1={"X","Y","Z"}), "W", IF(OR(A1={"G","H","I"}), "K", ""))

暂无
暂无

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

相关问题 如果单元格1包含w,则单元格2应等于x,如果单元格1包含y,则单元格2应包含z - If cell 1 contains w cell 2 should equal x, if cell 1 contains y cell 2 should contain z 如果单元格1包含X,则单元格2应等于W,如果单元格1包含Z,则查看下一个条件 - if cell 1 contains X, then cell 2 should equal W, if cell 1 contains Z, then look at next criteria 如果单元格1-10(范围)包含X,则单元格11应返回A;如果单元格范围1-10包含Y,则单元格11应返回B - If cell 1 - 10 (range) contains X , then Cell 11 should return A or if cell range 1-10 contains Y, then cell 11 should return B 如果单元格包含(x,y或z),则允许另一个单元格显示其公式值 - If cell contains (x,y or z) allow for another cell to display its formula value Excel 公式检查单元格是否包含“Y”,如果确实将单元格除以 2。如果单元格包含“N”,则执行 IFERROR VLOOKUP - Excel formula to check if a cell contains “Y”, if it does divide a cell by 2. If cell contains “N” then do a IFERROR VLOOKUP 基于x,y乘以z单元格值填充单元格 - Populate cells based on x by y by z cell value 使用带有某些字母的Excel&VLOOKUP在单元格中显示计数 - Display Count in cell with Excel & VLOOKUP w/Contains for certain letters Excel 公式,如果单元格包含 A、B 或 C,则等于 1,2 或 3 - Excel formula, if cell contains A, B or C, equal either 1,2 or 3 在Excel中,如何在单元格X中更改单元格Y的值,而仅在单元格X中键入 - How to , in excel, change the value of cell Y from cell X, while only typing in cell X Excel-当单元格等于x时查找范围值 - Excel - Find value of range when cell is equal to x
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM