且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Excel:匹配列,并在给定日期后找到下一个值

更新时间:2023-01-28 15:55:37

如果您不想排序数据,那么您将需要一个像这样的数组公式:$ / $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ($ G $ 2:$ G $ 13> = B2)*($ F $ 2:$ F $ 13 = A2),$ G $ 2:$ G $ 13-B2) :$ F $ 1 3 = A2),$ G $ 2:$ G $ 13-B2),0))

数组公式在编辑编辑模式时必须使用Ctrl-Shift-Enter而不是Enter进行确认。如果正确完成,Excel将围绕公式放入 {}



点击C2。将公式放在公式栏中。点击Ctrl-Shift-Enter。然后复制/下拉。




I am struggling with a formula and need help.

I have two tables: Table 1 - containing columns'.

"Cust_ID" and "Enrolled date"

Table 2 -containing

"Cust_ID" and "Invoice_date"

i need to match cust_ID and return the next date from invoice date column after enrolled date.

I used following formula but it didn't really worked for me.

=INDEX($G$2:$G$13,MATCH(A4,$F$2:$F$13,-1))

Please help.

If you do not want to sort your data then you will need an Array formula like this:

=INDEX($G$2:$G$13,MATCH(MIN(IF(($G$2:$G$13>=B2)*($F$2:$F$13=A2),$G$2:$G$13-B2)),IF(($G$2:$G$13>=B2)*($F$2:$F$13=A2),$G$2:$G$13-B2),0))

Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when editing edit mode. If done correctly then Excel will put {} around the formula.

Click on C2. Put the formula in the formula bar. Click Ctrl-Shift-Enter. Then copy/drag down.