I have Term, Creation Date, Days values available. Term can equal either "Beginning of next Month", "end of Month", "Now". I'm trying to create a function that takes "Term" and if the value in it is "Beginning of next month", it takes Creation date, goes to the end of that month, and then adds "days". So for example, If creation date is 1/1/2017 and the "Term" is "Beginning of next next month", and Days are 5. It goes to 1/31/2017 + 5, so the answer is 2/5/2017. I figured out an excel formula for it
IF(P3046="Beginning of next month",EOMONTH(DATE(YEAR(Creation date+days),MONTH(Creation date+days),15),0)+1,0)
But I cant figure out an equivalent in VBA to EOMONTH. This is what I tried:
IIF(Term = "Beginning of next month",DateSerial(year(Creation date+days),month(Creation date+days)+1,0)
But it didn't really work. It gives the answer but not the correct one. Does anyone see an error I don't see. I've been starting at it for a while so I might be missing something.
Thank you so much!!!