Acekay

New Member
Joined
Oct 19, 2018
Messages
11
Hi all.
I have one query about filling up the date if few criteria are fulfilled. Table is as follow;

ABCDEFGHI
1Buy DateMaturity Date31-03-1631-03-1731-03-1831-03-1931-03-2031-03-2131-03-22
212/09/1715/09/2015/09/1715/09/1815/09/1915/09/20
312/09/1705/09/2005/09/1805/09/1905/09/20
410/09/1725/10/2025/10/1725/10/1825/10/1925/10/20
510/09/1705/10/2005/10/1705/10/1905/10/1905/10/20
618/09/1712/08/2012/08/1812/08/1912/08/20
718/09/1722/08/2022/08/1822/08/1922/08/20

<tbody>
</tbody>

Range C2:I7 should be filled up with formula.
Please help.
Thanking you all in advance
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
C1 is clearly year to end of March 2016 - so what do you want in C2 - 15/09/15 ?

Sorry for the trouble. Row 1 is all year end.
In C2 cell it should be nil as buy date is 12/09/17 so for year end 31/03/2016 there will be no filling. As 12/09/17 is falling in year end 31/03/2018 it will reflect data from maturity column as 15th Sept but year will be 2017 so it should give result as 15/09/2017 in E2 & so on.

In 3rd row. 12/09/17 is buy date but as maturity day is prior i.e. 05/19 so it will not fall in 31/03/2018 but in 31/03/2019 and it will reflect 05/09/19 in E2 fatching day and month i.e.05th Sept from maturity column and year from column header i.e. 31/03/2019

Please write back if not clear.

Thanking you in advance.
 
Upvote 0
that's quite understood at first time as well... I have come up with a formula (actually a combination of many formule) but that looks clumsy.

=IF(AND(MONTH($C2)=MONTH($B2),DAY($C2)<DAY($B2),YEAR(D$1)>YEAR($B2)+1,YEAR(D$1)<=YEAR($C2)+1),DATE(YEAR($B2)+1,MONTH($C2),DAY($C2)),IF(AND(MONTH($C2)>=MONTH($B2),YEAR($C2)>=YEAR(D$1),YEAR($B2)<YEAR(D$1)),DATE(YEAR($B2),MONTH($C2),DAY($C2))))

Please note that it's not complete... Why am I posting this here because I don't want to proceed with this formula... I would prefer a neat formula.
If someone come up with a simple, short and neat formula, please let me know.

Acekay, you get the idea now... in case you want to proceed with this, go ahead.
 
Upvote 0
ABCDEFGHI
1Buy DateMaturity Date31/03/201631/03/201731/03/201831/03/201931/03/202031/03/202131/03/2022
212/09/201715/09/202015/09/201715/09/201815/09/201915/09/2020
312/09/201705/09/202005/09/201805/09/201905/09/2020
410/09/201725/10/202025/10/201725/10/201825/10/201925/10/2020
510/09/201705/10/202005/10/201705/10/201905/10/201905/10/2020
618/09/201712/08/202012/08/201812/08/201912/08/2020
718/09/201722/08/202022/08/201822/08/201922/08/2020
col D
01/04/201501/04/201601/04/201701/04/201801/04/201901/04/202001/04/2021
1Buy DateMaturity Date31/03/201631/03/201731/03/201831/03/201931/03/202031/03/202131/03/2022
212/09/201715/09/202015/09/1815/09/1915/09/2015/09/21row 15
312/09/201705/09/202005/09/1805/09/1905/09/2005/09/21
410/09/201725/10/202025/10/1825/10/1925/10/2025/10/21
510/09/201705/10/202005/10/1805/10/1905/10/2005/10/21
618/09/201712/08/202012/08/1812/08/1912/08/2012/08/21
718/09/201522/08/201822/08/1622/08/1722/08/1822/08/19
I changed the last row of data for test purposes
D15 is
=IF(AND($B15<D$13,$C15<D$13),"",IF($B15>D$14,"",LEFT(TEXT($C15,"dd/mm/yy"),6)&RIGHT(TEXT(D$14,"dd/mm/yy"),2)))
dragged across and down

<colgroup><col><col><col><col><col><col><col><col><col><col><col span="4"></colgroup><tbody>
</tbody>
 
Upvote 0
See if the following formula works for you:

=IF($A2 > IFERROR(EDATE($B2,-DATEDIF(EDATE(C$1+1,-12),$B2,"y")*12),0),"",IFERROR(EDATE($B2,-DATEDIF(EDATE(C$1+1,-12),$B2,"y")*12),""))
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,698
Members
448,979
Latest member
DET4492

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