Finding first date prior to another which is a multiple of a certain number of months.

SYKEMAKAVELI

New Member
Joined
Apr 18, 2023
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the following fields / inputs:
1) 'Start date' - in this example 9 June 2023, cell AV11
2) 'First date' - in this example 1 July 2013, cell AU16
3) 'Frequency' - 365.25 (in days), cell AV14 --> this can take any numeric value, and would typically range from 1 to 365.25

I have created a formula which finds the first date >= the 'First date', which is an exact multiple of 'Frequency' days prior to the 'Start date':
IF(AU16="","",IFERROR(AV$11-AV$14*FLOOR((AV$11-AU16)/AV$14,1),""))
This gives an output of 8 July 2013, the first date from 1 July 2013 which is an exact multiple of 365.25 days prior to 9 June 2023.

However, I want to modify the formula so that it retains the day value from the 'Start date'. i.e. instead of using 365.25 days as an input, I want to modify the formula to use a new input
'Mths offset' (cell AV13), which will be an integer value of 1, 2, 3,..., 12. The idea is effectively the same as above - I want to find the first date that is on or post 1 July 2013 (in this example), which is a multiple of 'Mths offset' months prior to the 'Start date'.
For example, if I used a value ' Mths offset' of '12', I would want it to return 9 July 2013, preserving the day value from the 'Start date' field.

Does anyone have a view as to how I can go about doing this, preferably (strongly) within a single formula?

Thanks in advance
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
would you be kind and post your data using the xl2bb add in (link below). Please included some expected results.
You can sanitize/dummy up your data for security.

Thanks in advance, and best wishes.
 
Upvote 0
Thanks for getting back to me.

I've pasted an example of what I"m after in the minisheets file below. I've shifted the cell references over, so they won't align to what I've outlined above, but hopefully you can follow from the formula in the sheet.

The target output is in the two right-hand columns.
Thanks



Book1
ABCDEFGHIJKLMNOPQ
1
2Inputs
3
4Current inputs
5Start date9/07/2023
6Frequency365.3days
7
8Additional inputs to use (see explanation in columns F, onwards)
9Mths offset12This input can be any integer from 1 through to 12
10
11Calcs / Output
12
13Current OutputTarget Output
14First_dateEnd_date1st trans.Last trans.1st trans.Last trans.
151/07/201329/05/20238/07/20138/07/20229/07/20139/07/2022
1630/05/202330/12/20239/07/20239/07/20239/07/20239/07/2023
17
18Current output - showing the 1st and last transaction in the date range, based on the required frequency.Desired output -
19
20I want to use cell C9 (Mths offset) to give the 1st and Last transaction date again, but using whole months and preserving the days in the "Start date" field.
21When I use days to deduct (like in coluns D / E), it will stuff up if I deduct, or add, past a leap year. Hence the desire to use whole months instead and keep the days value.
22The case where 'Mths offset' = 12 is probably an easy one to 'hack', but I want the formula to be scalable to any months deduction value.
23
24
25
26
Sheet1
Cell Formulas
RangeFormula
C15C15=+B16-1
D15:D16D15=IF(B15="","",IFERROR(C$5-C$6*FLOOR((C$5-B15)/C$6,1),""))
E15:E16E15=IF(D15="","",IFERROR(D15+FLOOR((C15-D15)/C$6,1)*C$6,""))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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