Excel: match column and find next value after a given date

三世轮回 提交于 2020-01-15 09:26:10

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/41186700/excel-match-column-and-find-next-value-after-a-given-date

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!