Excel formula in counting distance between a speci

2020-08-01 07:27发布

问题:

I am dealing with unlimited data that keeps adding a combination of rows every-time. I wanted a formula that would count the row distance between the First Lower limit to the Second Lower Limit. Please no VBA i want a formula only or array formula perhaps. I would truly appreciate it if someone could help. I have been trying to figure this out for months now.

Example:

回答1:

This should work. Paste in cell I2 and commit as an array-formula [control-shift-enter]. Then pull down.

=IF(LARGE(IF((A$1:F$1000=H2),ROW(A$1:A$1000),0),2)=0,0,LARGE(IF((A$1:F$1000=H2),ROW(A$1:A$1000),0),1)-LARGE(IF((A$1:F$1000=H2),ROW(A$1:A$1000),0),2))+1


回答2:

array formula:

{=SMALL(IF((C:C=E7),ROW(A:A),2^20),1)-SMALL(IF((B:B=E7),ROW(A:A),2^20),1)+1}

fill up and down.