Hi, I need to write a macro that has one row of dates. Row D. I need the macro to go down row and depending on the date I need to input a number to the cell to the right of that date.


If date < 12/22/16 insert value 0
if date >12/22/16 but < 12/31/16 insert value 1.....

and so on.

I am not sure much about code so please help me out thank you so much!

For this you donot have to write a macro in excel. You can do it by using IF(<Condition>,True Value,False Value) against a particular cell of the Sheet.


        =IF(A5<DATE(2016,12,22),0,IF((A5>=DATE(2016,12,22))*AND(A5<DATE(2016,12,31)),1,"Invalid Date"))


Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.