Search code examples
google-sheets

Based on a given date range, find the period "Period Beginning Date" for a given date outside the provided range


Need to write a formula that returns the "Pay Period Beginning" Date using the provided Pay Period Dates in C5 and D5. The number of days in the given pay period is in E5 (as of writing this, currently 14). So I need to find the beginning date of the 14 day period for thes dates inputed into column C.

Need to write this as an arrayformula that outputs down a column.

Link to Sheet

enter image description here


Solution

  • You may try:

    =vstack("Header",
     map(C8:C,lambda(Σ,if(Σ="",,C5+(E5*int(days(Σ,C5)/E5))))))
    

    enter image description here