Search code examples
excelexcel-formulatrend

Excel TREND function using a non-contiguous range


I have 3 columns with multiple rows of data:

Date, Actuals, and Forecast.

I introduced a 4th column, Trend, and want to use the TREND function in Excel using the latest 3 values from actuals. However, when I reach the Sep-2020 row, I run out of actual values to illustrate the trend, so I want to use the last 2 actuals (Jun and Jul) plus the previous Forecast (Aug).

This is what the file looks like

Question: is there a way for the TREND function to consume non-contiguous cells?


Solution

  • In D5 put:

    =TREND(IF(B2:B4<>"",B2:B4,C2:C4),A2:A4,A5)
    

    This is an array formula and depending on one's version may necessitate the confirmation of the array formula with Ctrl-Shift-Enter instead of Enter when exiting edit mode.

    Then copy down.

    enter image description here