PDA

View Full Version : Need help to convert formula to VBA code



HawaiianD
04-20-2016, 07:37 PM
Hi guys,

I currently have a formula to plot values if the date is within a certain range. I would need help to convert the formula into VBA.

=IF(AND(C$1>=INT($O7),C$1<=INT($P7)),"1.1","")& IF(AND(C$1>=INT($Q7),C$1<=INT($R7)),"1.2","")&IF(AND(C$1>=INT($S7),C$1<=INT($T7)),"1.3","")
All the dates fall between start and finish will insert a value on cell below. I have attached the workbook.

Thank you.

PAB
04-21-2016, 12:46 AM
Just a quick response as I am on my way out.

Give this a go for the formula...


"=IF(AND(C$1>=INT($O7),C$1<=INT($P7)),""1.1"","""")& IF(AND(C$1>=INT($Q7),C$1<=INT($R7)),""1.2"","""")&IF(AND(C$1>=INT($S7),C$1<=INT($T7)),""1.3"","""")"

I hope this helps!

HawaiianD
04-21-2016, 10:49 AM
I received an error message after entering your formula. It is pointing at ""1.1"".

HawaiianD
04-21-2016, 11:35 AM
Sorry, I think I know what you mean now. I got it to work. Thanks

PAB
04-21-2016, 12:52 PM
Yes, sorry about that HawaiianD,

I was in a rush because I was going out.
I am glad it works and you are welcome.

Thanks for the feedback :yes.