I'm working with Julian dates and day counts on a spreadsheet to determine the quantity of days in between posting orders and receiving orders. On my sheet in cell "N4" I have a formula that determines what the current Julian day is (i.e 1 though 365) and that portion is working fine. Below that cell in "N5" I need to determine the day count value for the reporting period which will be 28, 29, 30, or 31. I've developed the formulas but I'm at a loss as to successfully string them together as there are 13 date groups. I'm thinking that there may be a smarter method than to try to put 13 "Ifs" in one formula for inserting in a VBA macro. I've researched a couple of "Else If" statements but nothing as long as the one I'm attempting. Could anyone determine a smart way to assemble the following formulas (each formula works separately) The result of the day counts will be used in additional calculations.
"=IF(AND($N$4 >= 1, $N$4 <=15), 31)"
"=IF(AND($N$4 >= 16, $N$4 <=46), 31)"
"=IF(AND($N$4 >= 47, $N$4 <=74), 28)"
"=IF(AND($N$4 >= 75, $N$4 <=105), 31)"
"=IF(AND($N$4 >= 106, $N$4 <=135), 30)"
"=IF(AND($N$4 >= 136, $N$4 <=166), 31)"
"=IF(AND($N$4 >= 167, $N$4 <=196), 30)"
"=IF(AND($N$4 >= 197, $N$4 <=227), 31)"
"=IF(AND($N$4 >= 228, $N$4 <=258), 31)"
"=IF(AND($N$4 >= 259, $N$4 <=288), 30)"
"=IF(AND($N$4 >= 289, $N$4 <=319), 31)"
"=IF(AND($N$4 >= 320, $N$4 <=349), 30)"
"=IF(AND($N$4 >= 350, $N$4 <=365), 31)"
Will a series of "Else IFs" work for this in VBA???
Thanks,
JB
"=IF(AND($N$4 >= 1, $N$4 <=15), 31)"
"=IF(AND($N$4 >= 16, $N$4 <=46), 31)"
"=IF(AND($N$4 >= 47, $N$4 <=74), 28)"
"=IF(AND($N$4 >= 75, $N$4 <=105), 31)"
"=IF(AND($N$4 >= 106, $N$4 <=135), 30)"
"=IF(AND($N$4 >= 136, $N$4 <=166), 31)"
"=IF(AND($N$4 >= 167, $N$4 <=196), 30)"
"=IF(AND($N$4 >= 197, $N$4 <=227), 31)"
"=IF(AND($N$4 >= 228, $N$4 <=258), 31)"
"=IF(AND($N$4 >= 259, $N$4 <=288), 30)"
"=IF(AND($N$4 >= 289, $N$4 <=319), 31)"
"=IF(AND($N$4 >= 320, $N$4 <=349), 30)"
"=IF(AND($N$4 >= 350, $N$4 <=365), 31)"
Will a series of "Else IFs" work for this in VBA???
Thanks,
JB