Search code examples
excelformulas

Automatically change excel cell value depending on current Month


Stock analysis Dashboard. I need to compare the stock from today vs the previous 6 months.

My stock data

Cell A1:R1 - month data example Cell A1= June 2017, B1= 7/2017 ....till R1= December 2018.

Cell A2:R2 Stock numbers data example A2=23, B2=25,........till R2=50.

IF I want to see the stock today month which is July 2018= M1 vs six months February 2018 H2 and the stock level calculation will which is M2=26 - H2= 30 =-4.

But instead of entering formula every time I need to be updated every month based on the today month?

Any tips on how to do it?

Thanks


Solution

  • I also miss a date...

    If you use today() function to identify today's date you can use:

    =HLOOKUP(TODAY(),$A$1:$S$2,2)-HLOOKUP(DATE(YEAR(TODAY()),MONTH(TODAY())-5,1),$A$1:$S$2,2)

    If you need a cell with a specific date, replace today() formula with that cell.

    Excel printscreen