[英]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.