简体   繁体   English

Excel-如何将这些公式组合为一个?

[英]Excel - How to combine these formulas into one?

I have this worksheet which lists results oldest to newest dates. 我有此工作表,其中列出了最早到最新日期的结果。

I have these three formulas.. 我有这三个公式。

=IFERROR(LARGE(IF([@HomeTeam]=[HomeTeam],IF("H"=[FTR],IF([Date]<[@Date],IF([@Season]=[Season],[Date],"")))),1),"NULL")

=IFERROR(LARGE(IF([@HomeTeam]=[AwayTeam],IF("A"=[FTR],IF([Date]<[@Date],IF([@Season]=[Season],[Date],"")))),1),"NULL")

=IF(AND([@[SLWD_H1]]="NULL",[@[SLWD_H2]]="NULL"),"NULL",MAX(Results[@[SLWD_H1]:[SLWD_H2]]))

Basically the first looks for the last time the home team won a game at home. 基本上,第一次看是主队最后一次赢得主场比赛。

The second looks for the last time the home team won a game away from home. 第二个是主队最后一次赢得客场比赛。

And then the third gives me the latest date of the two mentioned above. 然后第三个给我上述两个日期的最新日期。

I was wondering if there was a way to combine all three into a single column instead of having to have three? 我想知道是否有一种方法可以将所有三个合并到一个列中,而不必有三个?

Thankyou in advance. 先感谢您。

**EDIT **编辑

To make myself a bit clearer! 让自己更加清晰! What I want is to combine the above 3 into one formula which will output the result! 我想要的是将上述3个组合为一个公式,该公式将输出结果!

So it will find the date in example 1 and find the date in example 2 and then it will output the latest date. 因此它将在示例1中找到日期,并在示例2中找到日期,然后输出最新日期。

Use the MAX formula to determine the highest date between the home and away dates. 使用MAX公式确定居住日期和离开日期之间的最高日期。

The formula would look like this: 公式如下所示:

=MAX(Number1,Number2) = MAX(数字1,数字)

The MAX formula will ignore the NULL text values. MAX公式将忽略NULL文本值。 However if both values are NULL , it will return a zero value. 但是,如果两个值均为NULL ,它将返回零值。 If formatted as a date it will show as 00/01/1900 如果格式化为日期,它将显示为00/01/1900

=MAX(IFERROR(LARGE(IF([@HomeTeam]=[HomeTeam],IF("H"=[FTR],IF([Date]<[@Date],IF([@Season]=[Season],[Date],"")))),1),"NULL"),IFERROR(LARGE(IF([@HomeTeam]=[AwayTeam],IF("A"=[FTR],IF([Date]<[@Date],IF([@Season]=[Season],[Date],"")))),1),"NULL"))

MAX公式的输出示例

If I understand correctly, would an OR("A"=[FTR],"H"=[FTR]) work? 如果我理解正确,OR(“ A” = [FTR],“ H” = [FTR])是否可以工作? This would work like your first formula except using both "A" and "H" games. 这将与您的第一个公式一样工作,除了同时使用“ A”和“ H”游戏。

=IFERROR(LARGE(IF([@HomeTeam]=[AwayTeam],IF(OR("A"=[FTR],"H"=[FTR]),IF([Date]<[@Date],IF([@Season]=[Season],[Date],"")))),1),"NULL")

Are these the only two values for [FTR]? 这些是[FTR]仅有的两个值吗? If so you could just get rid of that IF statement entirely requiring either H or A: 如果是这样,您可以摆脱完全需要H或A的IF语句:

=IFERROR(LARGE(IF([@HomeTeam]=[AwayTeam],IF([Date]<[@Date],IF([@Season]=[Season],[Date],""))),1),"NULL")

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM