简体   繁体   English

在 ArrayFormula 中使用多个 OR 条件

[英]Using multiple OR conditions in ArrayFormula

I've a column of names我有一列名字

Smith John Sr Smith John R Smith Jr John L Smith III John Smith John IV Smith John Sr Smith John R Smith Jr John L Smith III John Smith John IV

I know the Last Name is always the first word.我知道姓永远是第一个词。 I know the First is sometimes in the second word.我知道第一个有时在第二个词中。 However, sometimes "Jr" or "III" may be there instead.但是,有时可能会出现“Jr”或“III”。 Otherwise, the title can be in the fourth word if it is not the middle initial.否则,如果标题不是中间首字母,则标题可以在第四个单词中。

How do I use an arrayformula with multiple OR conditions so that I can extract into a second column the First Name, The Last Name, and the Applicable Title (eg Jr, Sr, III, IV).我如何使用具有多个 OR 条件的 arrayformula,以便我可以将名字、姓氏和适用标题(例如 Jr、Sr、III、IV)提取到第二列中。 I want to disregard the initial which I figured I could use a character count "=1" within the OR logic, correct?我想忽略我认为可以在 OR 逻辑中使用字符数“=1”的首字母,对吗?

If you already have your working formula, you can use + to join conditions that are meant to be at least one of them met (like OR) and * to join conditions that are meant to be together (like AND).如果您已经有了自己的工作公式,则可以使用 + 来连接至少满足其中一个条件的条件(如 OR),并使用 * 来连接应该在一起的条件(如 AND)。 For example:例如:

=IF(OR(A1=1,B1=1),1,0)

As an array you could do it:作为一个数组,你可以这样做:

=ArrayFormula(IF((A1:A=1)+(B1:B=1),TRUE,FALSE))

Since TRUE conditions are considered as 1 and FALSE conditions as 0, when you sum two conditions it will return 1 or more if one of them is TRUE;由于 TRUE 条件被视为 1,FALSE 条件被视为 0,因此当您将两个条件相加时,如果其中一个为 TRUE,它将返回 1 或更多; and with that positive result, it will apply the true statement of the IF.有了这个积极的结果,它将应用 IF 的真实陈述。 Hope it's useful希望有用

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

相关问题 PERCENTILE IF 对一组条件使用 ARRAYFORMULA - PERCENTILE IF using ARRAYFORMULA for a set of conditions 将 ARRAYFORMULA 与 SUMIF 一起用于多个条件以及使用通配符的条件。 按月计算的结果 - Using ARRAYFORMULA with SUMIF for multiple conditions combined with conditions using a wildcard. Result by Months 使用 ARRAYFORMULA 比较多个值与 AND - Comparing Multiple Values with AND using ARRAYFORMULA 在具有多个条件的 SUMIF 函数中使用 IF 公式插入范围(使用数组公式) - Insert range using IF formula in SUMIF function with multiple criteria (using arrayformula) 需要在谷歌工作表仪表板中使用嵌套或多个ARRAYFORMULA的帮助 - Need help using nested or multiple ARRAYFORMULA's in google sheet dashboard 使用查询和多个导入范围时,Arrayformula 未填充列 - Arrayformula not filling column when using query and multiple importranges 使用 ArrayFormula 计算多列和 output 每行的总和 - Using ArrayFormula to countif multiple columns and output the sum on each row ArrayFormula + 多个 IMPORTRANGE + QUERY - ArrayFormula + multiple IMPORTRANGE + QUERY 具有多个级别的Countif和ArrayFormula - Countif and ArrayFormula with multiple levels 在 Google 表格中使用数组公式 - Using arrayformula in Google Sheets
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM