简体   繁体   English

发出多标准INDEX MATCH公式

[英]Issue with a multiple criteria INDEX MATCH formula

so I used this array formula with INDEX MATCH: 所以我在INDEX MATCH中使用了这个数组公式:

{=INDEX(ENTRIES!$F$4:$F$28;MATCH(C4&F4&G4;ENTRIES!$C$4:$C$28&ENTRIES!$G$4:$G$28&ENTRIES!$H$4:$H$28;0))}

Here is the thing, I was trying to display the price of the "entries" sheet on the "sales" sheet, the problem comes up when there are different prices for one "Code" or product over time. 这就是问题,我试图在“销售”表单上显示“条目”表的价格,当一个“代码”或产品随时间推移有不同的价格时,就会出现问题。 I tried to solve it with an Index Match formula (above) that matches the price of the code (product) with the month and the year but it doesn't assign the price or any value on the months between the updates of the price. 我尝试使用索引匹配公式(上面)来解决它,该公式与代码(产品)的价格与月份和年份相匹配,但它不会在价格更新之间的月份上分配价格或任何值。 see picture 看图

example: for month 6 it should assign the price of month 5 because there is not any update or change. 例如:对于第6个月,它应该分配第5个月的价格,因为没有任何更新或更改。 and the same for month 9 it should be the same e of the month 8 for that product. 对于第9个月,它应该与该产品的第8个月的e相同。 How can I do that? 我怎样才能做到这一点?

Looks to me like it's throwing those errors because it won't be able to find these months. 在我看来,它正在抛出这些错误,因为它无法找到这些月份。 In all cases these months are missing, at least with your data, you could tell the formula to pick the maximum row from the data that is below or equal to your search month using MAX() 在所有情况下,这几个月都会丢失,至少在您的数据中,您可以告诉公式使用MAX()从数据中选择低于或等于搜索月份的最大行数

Furthermore, matching multiple criteria through concatenating cells and columns can get tricky once numeric values/dates are involves and could throw back wrong/unexpected results. 此外,通过连接单元格和列来匹配多个条件可能会在涉及数值/日期时变得棘手,并且可能会丢失错误/意外结果。 Try something along these lines instead: 尝试沿着这些方向尝试:

MATCH(1,((Criteria1)*(Criteria2)*(Criteria3))...

So the whole thing would look like: 所以整个事情看起来像:

=INDEX(ENTRIES!$F$1:$F$28;MAX(((ENTRIES!$C$4:$C$28=C4)*(ENTRIES!$G$4:$G$28<=G4)*(ENTRIES!$H$4:$H$28=H4)*ROW(ENTRIES!$F$4:$F$28))))

Entered through Ctrl Shift Enter 通过Ctrl Shift Enter输入

@JVDV answer was helpful, but it didn't work for me because it gives me a higher value instead of the latest price for the last month known not the next one. @JVDV答案很有帮助,但它对我不起作用,因为它给了我更高的价值,而不是上个月的最新价格而不是下一个。

Anyway looking at your formula, I finally came up with this: 无论如何看着你的公式,我终于想出了这个:

{=IFERROR((INDEX(ENTRIES!$F$4:$F$28;MATCH(C8&J8&K8;ENTRIES!$C$4:$C$28&ENTRIES!$G$4:$G$28&ENTRIES!$H$4:$H$28;0)));INDEX(ENTRIES!$F$4:$F$28;MATCH(1;(ENTRIES!$C$4:$C$28=C8)*(ENTRIES!$G$4:$G$28=J8-1)*(ENTRIES!$H$4:$H$28=K8);0)))}

The first part is my original formula but now when it throws an error applies the second INDEX which finds the price of the month before the month with no price in the data. 第一部分是我的原始公式,但现在当它抛出错误时,应用第二个INDEX,它找到月份前一个月的价格,数据中没有价格。 Of course, it's isn't perfect either because I have to "update" the price at least every two months. 当然,这也不完美,因为我必须至少每两个月更新一次价格。

I tried another way with a <= sign but it didn't work either. 我用<=符号尝试了另一种方式,但它也没有用。

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

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