formula understanding and improving

Imran Azam

Board Regular
Joined
Mar 15, 2011
Messages
103
Hi Guys

hope all is well

i have the below table at work with data and forumla, and i need help understanding

1) what the formula are doing
2) if i can improve these formula ( is there a more efficient way to do this.

ABCDEFGHIJK
1NAMESTART DATEEND DATETOTALLENGTH OF CONTRACT (NO OF MONTHS)FIRST DATE OF START DATELAST DATE OF END DATE PER MONTH30/06/201631/07/201631/08/2016
2subscription 107/04/201607/04/201695101/04/201630/04/201695.00--
3subscription 203/04/201609/08/2016479.16501/04/201631/08/201695.8395.839696

<tbody>
</tbody>


the formula for subscription 1 cell I2,J2,K2 are as follows

cell I2 : IF(DATEVALUE(I$1)-TRIM($G2)>=0,$D$2,IF(DATEVALUE(I$1)-TRIM($F2)>0,DATEDIF($F2,I$1+30,"m")*H2,0))

cell J2 : below IF(AND($E2=1,I2<>0),0,IF(AND($E2=1,MONTH($C2)&YEAR($C2)=MONTH(J$1)&YEAR(J$1)),$H2,IF(MONTH($B2)&YEAR($B2)=MONTH(J$1)&YEAR(J$1),$H2,IF(AND(RIGHT(J$1,4)&MID(J$1,4,2)&LEFT(J$1,2)>TEXT($F2,"YYYYMMDD"),RIGHT(J$1,4)&MID(J$1,4,2)&LEFT(J$1,2)<= TEXT($G2,"YYYYMMDD")),$H2,0))))

cell K2 : below : IF(AND($E2=1,J2<>0),0,IF(AND($E2=1,MONTH($C2)&YEAR($C2)=MONTH(K$1)&YEAR(K$1)),$H2,IF(MONTH($B2)&YEAR($B2)=MONTH(K$1)&YEAR(K$1),$H2,IF(AND(RIGHT(K$1,4)&MID(K$1,4,2)&LEFT(K$1,2)>TEXT($F2,"YYYYMMDD"),RIGHT(K$1,4)&MID(K$1,4,2)&LEFT(K$1,2)<= TEXT($G2,"YYYYMMDD")),$H2,0))))

the formula for subscription 2 cell I3,J3,K3 are as follows

cell I3: IF(DATEVALUE(I$1)-TRIM($G3)>=0,D3,IF(DATEVALUE(I$1)-TRIM($F3)>0,DATEDIF($F3,I$1+30,"m")*H3,0))

cell J3:
below
IF(AND($E3=1,I3<>0),0,IF(AND($E3=1,MONTH($C3)&YEAR($C3)=MONTH(J$1)&YEAR(J$1)),$H3,IF(MONTH($B3)&YEAR($B3)=MONTH(J$1)&YEAR(J$1),$H3,IF(AND(RIGHT(J$1,4)&MID(J$1,4,2)&LEFT(J$1,2)>TEXT($F3,"YYYYMMDD"),RIGHT(J$1,4)&MID(J$1,4,2)&LEFT(J$1,2)<= TEXT($G3,"YYYYMMDD")),$H3,0))))

cell K3:
below
=IF(AND($E3=1,J3<>0),0,IF(AND($E3=1,MONTH($C3)&YEAR($C3)=MONTH(K$1)&YEAR(K$1)),$H3,IF(MONTH($B3)&YEAR($B3)=MONTH(K$1)&YEAR(K$1),$H3,IF(AND(RIGHT(K$1,4)&MID(K$1,4,2)&LEFT(K$1,2)>TEXT($F3,"YYYYMMDD"),RIGHT(K$1,4)&MID(K$1,4,2)&LEFT(K$1,2)<= TEXT($G3,"YYYYMMDD")),$H3,0))))

can anyone help with this?

Thank you
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,215,161
Messages
6,123,378
Members
449,097
Latest member
Jabe

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