none
Excel formula - comparing a date to today() RRS feed

  • Question

  • Hi

    I'm looking for an excel formula that will be driving a graphical indicator. Amongst other things the formula will be comparing a date in a cell to see whether before or after today. The formulas are copied to a range using vba.

    I thought this would be easy but have tried using =IF(J2<TODAY(),1,0) etc without success.

    Must be an easy solution - is it datevalue or something Iike that I need to use?

    Thanks

    Brian


    Brian Hyam
    Monday, February 6, 2012 4:19 PM

Answers

  • That formula should work OK, eg applied with VBA over a contiguous range

    Range("K2:K5").Formula = "=IF(J2<TODAY(),1,0)"

    The only thing to be aware of is the formula will need to be recalculated each day.

    Peter Thornton

    • Proposed as answer by Shasur Wednesday, February 8, 2012 2:52 AM
    • Marked as answer by danishaniModerator Saturday, February 11, 2012 9:39 PM
    Monday, February 6, 2012 5:00 PM
    Moderator