对具有缺失值且缺失值序列数量不确定的行中数据进行线性插值的动态解决方案是什么? [英] What is the dynamic solution to a linear interpolation of data in a row with missing values with an indefinite number of missing value sequences?
问题描述
我有此数据
Date Data
8/25/2017 980
8/24/2017 64
8/23/2017 593
8/22/2017 595
8/21/2017
8/20/2017
8/19/2017 794
8/18/2017 437
8/17/2017
8/16/2017
8/15/2017
8/14/2017 629
如果我想在单元格8月21日(794-595)/ 3和2 *(794-595)怎么办/ 3,在8月22日的单元格中,以及类似的(629-437)/ 4,在8月17日,在2 *(629-437)/ 4,在8月16日,等等...
What if i wanted (794-595)/3 in cell 21st August and 2*(794-595)/3 in cell 22nd August and similarly (629-437)/4 in 17th August, 2*(629-437)/4 in 16th August etc...
整个数据集中只有2个缺失的数据序列。但是我希望能够在不事先知道丢失序列数的情况下完成所有这些操作。
And there are only 2 missing sequences of data in the entire data set. But i want to be able to do all this without knowing the number of missing sequences in advance.
如何动态地执行此操作而不考虑中间的缺失值数量?
How to do this dynamically without regard to the number of missing values in between?
推荐答案
对于公式路线,您将需要一个帮助列:
For a formula route you will need a helper column:
在该帮助列的第2行中输入:
In row 2 of that helper column put:
=IF(B2="",INDEX(B:B,MATCH(1E+99,$B$1:B1))+((ROW() - MATCH(1E+99,$B$1:B1))*(INDEX(B2:INDEX(B:B,MATCH(1E+99,B:B)),MATCH(TRUE,INDEX((B2:INDEX(B:B,MATCH(1E+99,B:B))<>""),),0))-INDEX(B:B,MATCH(1E+99,$B$1:B1)))/(MATCH(TRUE,INDEX((B2:INDEX(B:B,MATCH(1E+99,B:B))<>""),),0)+ROW()-1-MATCH(1E+99,$B$1:B1))),B2)
并向下复制范围
然后,如果您愿意,可以将值复制并粘贴回原始数据。
Then if you want you can copy and paste the values back over the original data.
这篇关于对具有缺失值且缺失值序列数量不确定的行中数据进行线性插值的动态解决方案是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!