duplicating entries for every year until the end date

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,053
Office Version
  1. 365
Platform
  1. Windows
i am mapping out contracts in power query. each contract is entered into the system and effort (labour) is apportioned to it. the user has asked that i add in the effort taken to review each valid contract annually. there is a formula used to calculate each review date out until the last review prior to contract end date. for each review, i need to create a new entry in the table.

as an example, contract number AB456321 starts 25/12/2023 and ends 24/12/2030. with all conditions satisfied for a review, the review dates would be 25/12/2024, 2025, 2026, 2027, 2028, 2029. the end result in my table would then be 7 entries: one original contract and 6 review exercises.

Any help would be appreciated as I am googling up a storm and getting nowhere fast this morning.
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Show us a sample of what your data looks like now and what you would like it to look like after PQ is applied. Please use XL2BB and no pictures as they cannot be manipulated.
 
Upvote 0
Book4
ABCDEFGHIJKLM
3Contract OwnerContractDescriptionPartiesEnd DateBusiness NeedContract StatusStart DateSectionNext ActivityContract Length (Years)
4MeAJM000088Software AppSoftware Company26-Sep-2027OngoingApproved27/09/2017Goods & ServicesExtend10EXISTING
5MeAJM000088Software AppSoftware Company26-Sep-2024OngoingApproved27/09/2017Goods & ServicesPrice & Performance Review10EXISTING
6MeAJM000088Software AppSoftware Company26-Sep-2025OngoingApproved27/09/2017Goods & ServicesPrice & Performance Review10NEW
7MeAJM000088Software AppSoftware Company26-Sep-2026OngoingApproved27/09/2017Goods & ServicesPrice & Performance Review10NEW
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
M4:M7Cell Value>5textNO


the conditions that need to be met for a Price and Performance review to be set are Business Need is Ongoing and Contract Status is Approved.

the original contract is in the first row with the Price and Performance Review set on the anniversary of the start date each year. this continues until the last year of the contract. At the moment, only the next PPR is included (these are the records marked EXISTING in the last column above). As this particular contract runs until 26 Sep 2027 and the next review is set for 2024. i need also to be able to list the next PPR dates in 2025 and 2026.
 
Upvote 0
anyone?

it would even help if i knew what to search for on the internet. using "insert rows" generally lists a bunch of entries about manually inserting a row. i need to figure out a way to trigger the insertion.
 
Upvote 0
list.generate seems to help. but i need the dates to increment each year until the expiry year.
 
Upvote 0
This will give you a list of the years involved, then you can expand it into new rows and add days and months afterward. Is that helpful?

{Date.Year([Start Date])..Date.Year([End Date])}
 
Upvote 0
Thanks automatrix. I used

Power Query:
= Table.AddColumn(#"Added Custom", "Future PPR", each let startDate = Date.AddYears([EndDate],1), endDate = [EndDateOriginal] in List.Combine({{[EndDate]}, List.Generate(()=> startDate, each _ <= endDate, each Date.AddYears(_, 1))}))


i now need to add a condition to the above that will not return a date when the "Future PPR" date is less than 12 months from the End Date. EG so if the contract start date is 1 Jan 2020 and its end date 31 July 2024, the final PPR should be 1 Jan 2023, not 1 Jan 2024.

any ideas?
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,223,934
Messages
6,175,492
Members
452,649
Latest member
mr_bhavesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top