Help with IF formula

Bulloff

New Member
Joined
Jul 2, 2016
Messages
13
Hello,

I am trying to create a formula that substracts dates and if result (in this case moths) is higher than 12, I want it to multiply it by cell "T8" or do nothing if result is less than 12. Below is the formula:

=IF((YEAR(P8)-YEAR($V$4))*12+MONTH(P8)-MONTH($V$4))-12>0,*T8,""))

Any advice is greatly appreciated.

Thanks,
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
=IF((YEAR(P8)-YEAR($V$4))*12+MONTH(P8)-MONTH($V$4))>12,(YEAR(P8)-YEAR($V$4))*12+MONTH(P8)-MONTH($V$4))*T8,"")) ?

I am assuming that
(YEAR(P8)-YEAR($V$4))*12+MONTH(P8)-MONTH($V$4)) has been tested and is correct. Also what is meant to happen if the difference is 12?
 
Upvote 0
Thanks wleshgasman. Based on your suggestion I managed to create the formula I needed. Here is how it is looking now:
I needed it to divide some account balance into short term and long term and multiply the excess of 12 , which is the long term to find out what will be the long term balance.

=IF((YEAR(P8)-YEAR($W$4))*12+(MONTH(P8)-MONTH($W$4))-12>0,((YEAR(P8)-YEAR($W$4))*12+MONTH(P8)-MONTH($W$4)-12)*U8,"")
 
Upvote 0
I would still decide what happens if you get 0, which side does is it meant to drop into?. At present it will be blank?
 
Upvote 0
I would still decide what happens if you get 0, which side does is it meant to drop into?. At present it will be blank?

Correct, balnk will be fine because it is within the 12 month period I am checking. I could change the test to >= , but It will give me 0 when it is 12, which does not change the result in my case. Thanks for looking into it though.
 
Upvote 0
Sorry to be pedantic, but consider what happens if someone picks up your code/formulae and has to amend it. For clarity you should amend the code/formulae to cover all eventualities, and that way it will be clear to anyone who has to follow up on the code/formulae? I even do it so that I do not get caught out 6 months later? :-)
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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