I am trying to do some data validation in Excel but have a difficulty in making vlookup
work recursively.
Here is a small sample of data
+---------------+-----------------+
| Duration(sec) | Start time(sec) |
+---------------+-----------------+
| 1.428571429 | 96.57142857 |
| 1.888888889 | 95 |
| 1.888888889 | 96.22222222 |
| 2.428571429 | 95.71428571 |
| 2.75 | 96 |
| 2.8 | 95.3 |
| 2.846153846 | 94.30769231 |
| 2.857142857 | 97.42857143 |
| 3 | 94.8 |
| 3 | 97 |
| 3 | 99 |
| 3.111111111 | 95.66666667 |
| 3.2 | 95.5 |
| 3.333333333 | 96.22222222 |
| 3.416666667 | 80.33333333 |
| 3.416666667 | 94.16666667 |
| 3.5 | 94.1 |
| 3.615384615 | 78.92307692 |
+---------------+-----------------+
First column is the duration of an event and the second the starting point. I need to find the average starting point of the e.g. 5 items with smallest duration.
I started like this: {=AVERAGE(SMALL(IF(ISNUMBER(B:B),B:B,""),ROW(INDIRECT("1:5"))))}
which gives me the average of 5 smallest durations. So far so good. It works as it should.
Then tried to mix the above with vlookup
so that in the first step it will return the 5 smallest durations and then will lookup for the corresponding starting points and then calculate the average of them.
I tried: {=AVERAGE(VLOOKUP(SMALL(IF(ISNUMBER(B:B),B:B,""),ROW(INDIRECT("1:5"))),B:C,2,FALSE))}
but with no luck. VLOOKUP
seems to return only one value. So I can not use it like this.
Any ideas?
P.S. I use ISNUMBER
because I have NaN values in the data.