Return next day based on a date
This tutorial shows how to return the next day based on a specific date through the use of an Excel formula or VBA
Example: Return next day based on a date
=TEXT(B5+1,"dddd")
|
This formula uses the Excel TEXT function with the "dddd" criteria to return the next day based on a specific date. Please note if you want to return the day number you will need to replace the "dddd" criteria with "d", which in this example will return a number of 11.
|
Sub Next_Day_based_on_a_Date()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'return the next day based on a specific date
ws.Range("D5") = Format(DateAdd("d", 1, ws.Range("B5")), "dddd")
ws.Range("D5") = Format(DateAdd("d", 1, ws.Range("B5")), "dddd")
End Sub
ADJUSTABLE PARAMETERS
Output Range: Select the output range by changing the cell reference ("D5") in the VBA code.
Date: Select the date from which to return the next day by changing the cell reference ("B5") in the VBA code.
Worksheet Selection: Select the worksheet where you want to return the next day based on a date by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name 'ws' in the VBA code.
Output Range: Select the output range by changing the cell reference ("D5") in the VBA code.
Date: Select the date from which to return the next day by changing the cell reference ("B5") in the VBA code.
Worksheet Selection: Select the worksheet where you want to return the next day based on a date by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name 'ws' in the VBA code.
EXPLANATION
This tutorial shows and explains how to return the next day based on a specific date using an Excel formula or VBA.
This tutorial provides one Excel method that can be applied to return the next day based on a specific date with the use of the TEXT function. The formula initially adds one day to the selected date to return the next date, by one day, and then using the TEXT function with the "dddd" criteria the formula returns the day.
Please note if you want to return the day number you will need to replace the "dddd" criteria with "d".
This tutorial provides one VBA method that can be applied to return the next day based on a date.
FORMULA
=TEXT(date+1),"dddd")
=TEXT(date+1),"dddd")
ARGUMENTS
date: The date from which to return the next day.
date: The date from which to return the next day.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Return previous day based on a date | How to return the previous day based on a specific date using Excel and VBA methods | |
Return previous day based on current day | How to return the previous day based on the current day using Excel and VBA methods | |
Return next month based on current month | How to return the next month based on the current month using Excel and VBA methods | |
Return previous month based on a date | How to return the previous month based on a specific date using Excel and VBA methods | |
Return next month based on a date | How to return the next month based on a specific date using Excel and VBA methods |
RELATED FUNCTIONS
Related Functions | Description | Related Functions and Description |
---|---|---|
TEXT Function | The Excel TEXT function returns a numeric value as text, in a specified format |