好吧,尽管经过多次迭代,ChatGPT 和 MS Copilot 仍无法提供帮助。在这里和其他地方的谷歌搜索没有找到任何我认为有用的东西。所以也许真正的大脑可以帮助解决这个问题(那就是你!)
我有一小列数值数据(n <= 10) that is collected from a table using Index/Match. There are gaps in the data which I need to linearly interpolate with an Excel formula. The gaps can be anywhere from one to three or four cells in size and they won't always be in the same location (not in the same rows for each set of results). Any meaningful data will be increase in value as you proceed down the rows. In another column, I need the formula to:
...依此类推。
这可以在 Excel 公式中实现吗?如果这在公式中不可行,我可以切换到 VBA。
谢谢!
AI建议的例子,但函数的参数总是太多或太少: (F 列包含天/行,I 包含数据,J 是目标单元格)
=IF(ISBLANK(I2), FORECAST.LINEAR(J2, INDEX(I:I, MIN(IF(I:I<>"", ROW(I:I)))), INDEX(J:J, MIN(IF(I:I<>"", ROW(I:I)))) : INDEX(J:J, MAX(IF(I:I<>"", ROW(I:I)))), INDEX(I:I, MIN(IF(I:I<>"", ROW(I:I)))) : INDEX(I:I, MAX(IF(I:I<>"", ROW(I:I))))), I2)
=IF(ISBLANK(I2), FORECAST(J2, INDEX(I:I, SMALL(IF(I:I<>"", ROW(I:I)-ROW($I$2)+1))), INDEX(J:J, SMALL(IF(I:I<>"", ROW(I:I)-ROW($I$2)+1)))), I2)
=IF(ISBLANK(I2), INDEX(LINEST(INDEX($I$2:$I$12, N(IF({1}, SMALL(IF($I$2:$I$12<>"", ROW($I$2:$I$12)-ROW($I$2)+1)))), INDEX($J$2:$J$12, N(IF({1}, SMALL(IF($I$2:$I$12<>"", ROW($I$2:$I$12)-ROW($I$2)+1))))), 2, 1) * J2 + INDEX(LINEST(INDEX($I$2:$I$12, N(IF({1}, SMALL(IF($I$2:$I$12<>"", ROW($I$2:$I$12)-ROW($I$2)+1)))), INDEX($J$2:$J$12, N(IF({1}, SMALL(IF($I$2:$I$12<>"", ROW($I$2:$I$12)-ROW($I$2)+1))))), 2, 2), I2)
[这个公式“有效”,但返回的值没有正确/均匀地插值:]
=IF(ISNUMBER(I2), I2, IFERROR(FORECAST.LINEAR(F2,IF(ISNUMBER(I$2:I$12),I$2:I$12,""),F$2:F$12), ""))