I have an Excel worksheet. In cell A2, I have the month "April". In cell B2, I would like to have this calculate one month from A2. So in other words, if I type in April in cell A2, I want May to automatically populate in cell B2.
If Left(incell, 3) = Left(month_array(11), 3) Then
If l = 3 Then
Next_Month = Left(month_array(0), 3)
Else
Next_Month = month_array(0)
End If
Else
If Left(month_array(i), 3) = Left(incell, 3) Then
If l = 3 Then
Next_Month = Left(month_array(i + 1), 3)
Else
Next_Month = month_array(i + 1)
End If
Else
End If
End If
Next i
-------------------------------------------------------------------------------------------- We want to help you; help us to do it by reading this: Before you ask a question.
You may have been "Stuck" with data that you inherited from another person.
But when you CREATE your own data/stucture, that has ANYTHING to do with dates (ie days, months, years) use REAL DATES!
Real Excel Dates are simply NMBERS. Like Today is 38080, however, when you enter a date, you usually enter something like 4/3/2004. Excel is SMART enough to RECOGNIZE that you have entered a DATE, CONVERTS the sring of characters that you entered to a NUMBER and FOMATS the NUMBER to display as 4/3/2004.
THEN...
if you were to CHANGE the format in Format/Cells - Number Tab, Category: Custom, Type: mmmm and [OK]...
your DATE would be DISPLAYED as...
April
The date VALUE is STILL 38080!
Entering date-related data as a REAL DATE makes REAL SENSE and aids in the manipulation of the data.
Skip,
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
Hello All,
In keeping with "there is always another way", if you are planning to write your own code to solve this question. I would suggest using this function:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.