本文介绍了具有固定行和动态列的复杂查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我想要实现的一个例子:



季度 G1 。这适用于 1,4,7,10 中可以在 C2:C5 中找到的期间。在 J2 中,我需要一个公式来检查 I2 是否等于之前提到的四个值之一,哪些可以在列C 中找到。因此,我必须首先在 A1:D4 中查找相应的 Quarter 列,然后根据此检查是否列包含 I2 中的值。如果是这种情况,那么 I2 应该写在 J2 else 0



我的问题是如何在我的公式中动态地引用所选时段的相应列?对于 Quarter 我需要检查 I2 是否在 C2:C5 ,但是对于半年,列更改为 B2:B5 。如果可能的话,我想避免一个复杂的IF公式。



解决方案

这是单元格J2的公式:

  = IFERROR(IF(MATCH(I2,INDEX(A $ 2:D $ 13,MATCH($ G $ 1,A $ 1:D $ 1)))I2))
/ pre>

Here is an example of what I want to achieve:

Quarter is selected in G1. This applies to periods 1, 4, 7, 10 as can be found in C2:C5. In J2 I need a formula which checks if I2 is equal to one of those four values mentioned before and which can be found in column C. Therefore, I have to first lookup the respective column of Quarter in A1:D4 and then based on this check if this column contains the value in I2. If this is the case then I2 should be written in J2 else 0.

My problem is how can I dynamically reference the respective column of the selected period in my formula? For Quarter I need to check ifI2 is in C2:C5, but for Half-Year the column changes to B2:B5. If possible, I want to avoid a complex IF formula for that part.

解决方案

This is the formula for cell J2:

=IFERROR(IF(MATCH(I2,INDEX(A$2:D$13,,MATCH($G$1,A$1:D$1,)),),I2),)

这篇关于具有固定行和动态列的复杂查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 06:43