Formula Map - Refer to the NextValue after CurrentValue - excel

I have a multiple list of dates, where in number of elements are varied.
E.g.
[September 1, 2010, July 1, 2016, July 1, 2022]
[September 1, 2010, July 1, 2016, July 1, 2022, September 2, 2023]
[September 1, 2010, July 1, 2016, July 1, 2022, September 2, 2023, January 1, 2025]
I want to use FormulaMap to subtract the years
2nd date - 1st date, 3rd date - 2nd date, 4th date - 3rd date, 5th date - 4th date
thisRow.[List of Effective Dates].FormulaMap( NextValue - CurrentValue) //doesnt work ( NextValue is not valid)
How will I refer to the next value of the current value of the list ? Or?is there any other way to do it (loop) ?

Related

Identify Gap Years Between Multiple Dates in Excel

For example, I have these list of dates (These are of type 'date')
Sept 1, 2010
July 1, 2016
July 1, 2022
The gap years between these dates are 6 years. Another Example:
Sept 1, 2010
July 1, 2012
Sept 1, 2014
July 1, 2016
The gap years between these dates is 2. How will I make a formula to identify the gap years?
You should check out DATEDIF function:
https://support.microsoft.com/en-us/office/datedif-function-25dba1a4-2812-480b-84dd-8b32a451b35c
You can create a new column:
Gap_row = Previous Row - Current Row
D2 = IFERROR(IF(D1<0;0;C2-C1);0)
Then create a pivot table for year and show Max(Gap_Row).
The Grand total for Max of Year Gap is the Year Gap for those rows:
Starting at your second date, just do =YEAR(A2)-YEAR(A1)

Assign Time Group to range of times in excel

I need help assigning a group to specific times based on hour and day of the week.
So far I have
=LOOKUP(HOUR(C2),{0,2,6,16,18,23},{"LATENIGHT","OVERNIGHT","DAYTIME","FRINGE","PRIME","FRINGE"})
which is doing the job for Monday to Friday.
On weekends however I need
=LOOKUP(HOUR(C2),{0,2,6,18},{"LATENIGHT","OVERNIGHT","WEEKEND","PRIME"})
and I have no idea how to include an OR statement.
I have my days of the week on B2 using =TEXT(A2,"dddd") to reference my date column.
Data sample:
- May 22, 2020 Friday 6:45:56 AM DAYTIME
- May 22, 2020 Friday 4:15:56 PM FRINGE
- May 23, 2020 Saturday 10:15:56 AM DAYTIME (should be WEEKEND)
- May 24, 2020 Sunday 12:15:56 PM DAYTIME (should be WEEKEND)
- May 25, 2020 Monday 12:21:18 AM LATENIGHT
=IF(
WEEKDAY(C2,3)>4,
LOOKUP(
HOUR(C2),
{0,2,6,18},
{"LATENIGHT","OVERNIGHT","WEEKEND","PRIME"}
),
LOOKUP(
HOUR(C2),
{0,2,6,16,18,23},
{"LATENIGHT","OVERNIGHT","DAYTIME","FRINGE","PRIME","FRINGE"})
)

Python Date and Time

I am trying to create a function that will return variable value depending on date and time. I am trying to create a small competition every month and the competition starts from 15th of one month and ends 15th of next month. If the competition is starting from Jan 15 and ending on Feb 15 then the function should return end date and time which is (Feb 15, 2020 24:00:00) and competition name which is "January 2020". How can i do this any suggestions?
For instance:
def CompetitionDetail():
#doing something here
return competition_end_date, competition_name
In response to your question, I came up with the following below. The returns are the start and end date/times of the competition that begins on the 15th of the current month and ends on the 15th of the following month. The function accepts a date but uses today's date if no date is specified.
from datetime import datetime, date
def competition(date=date.today()):
fifteenth_this_month = datetime(date.year, date.month, 15, 23, 59, 59)
fifteenth_next_month = datetime(date.year, date.month + 1, 15, 23, 59, 59)
competition_name = f'My awesome competition for the month of ' \
f'{fifteenth_this_month:%B %Y}.'
competition_ending = f'This awesome competition ends on ' \
f'{fifteenth_next_month:%b %d, %Y} at 24:00:00.'
print(competition_name, competition_ending, '', sep='\n')
return fifteenth_this_month, fifteenth_next_month
OUTPUT
My awesome competition for the month of August 2020.
This awesome competition ends on Sep 15, 2020 at 24:00:00.
(datetime.datetime(2020, 8, 15, 23, 59, 59), datetime.datetime(2020, 9, 15, 23, 59, 59))

Excel 2016 calculate fiscal year

Fiscal Year starts July 1 - June 30, I need to calculate and display the number of Fiscal Years between 2 dates.
For example: 01/01/2018-12/31/2018. Result (YYYY-YYYY) should give 2 fiscal years:
2017-2018 (July 1, 2017 - June 30, 2018)
2018-2019 (July 1, 2018 - June 30, 2019)
Its easy to calculate if there are only 2 fiscal years between 2 dates but using =IF(StartDate<DATE(YEAR(StartDate), 7,1),CONCATENATE(YEAR(StartDate)-1, "-", YEAR(StartDate)), CONCATENATE(YEAR(StartDate), "-", YEAR(StartDate)+1)) or
=IF(EndDate<DATE(YEAR(EndDate), 7,1),CONCATENATE(YEAR(EndDate)-1, "-", YEAR(EndDate)), CONCATENATE(YEAR(EndDate), "-", YEAR(EndDate)+1))
But how do I capture if there are more than 2 fiscal years? For example: 01/01/2018 - 09/20/2019
I would prefer the fiscal year be entered in a table range and automatically insert a new row if there are more than 2 fiscal years. I'm looking for either formula or vba solution.
last time i had to do this was for a specific report where the dates are written in cells:
dim s as long, e as long
if month(cells(1,1).value) >= 7 AND day(cells(1,1).value) >= 1 Then
s = year(cells(1,1).value)+1
else
s = year(cells(1,1).value)
end if
if month(cells(2,1).value) >= 7 AND day(cells(1,1).value) >= 1 Then
e = year(cells(1,1).value)+1
else
e = year(cells(1,1).value)
end if
'FY range:
cells(3,1).value = "FY" & s & "-FY" & e
rehashed the code for you, untested

Convert date format from dd/mm/yyyy to mm/dd/yyyy?

I have the following dates on my Excel sheet.
02/01/2017
02/02/2017
02/03/2017
02/07/2017
2/15/2017
2/16/2017
I want it to read as Feb 1, Feb 2. etc however Excel reads the dates as January 2, 2017, Feb 02, 2017, March 02, 2017.
How do I do this? Help please.
This is a built in function in Excel. Try from the ribbon above,
Number Group > More Number Formats > Date > Your desired Format
If you're looking for more customizability, try separating them by the / symbol using text to columns function from the Data tab in the ribbon.
This is what I got from punching in your data:
February 1, 2017
February 2, 2017
February 3, 2017
February 7, 2017
February 15, 2017
February 16, 2017

Resources