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.

Example.

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!

Recommended Answers

All 2 Replies

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.

Like

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

Thanks

Thank you!

Be a part of the DaniWeb community

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