Nesting IF and DATEDIF

Ken Russell

New Member
Joined
Sep 8, 2014
Messages
20
I have a spreadsheet with the following cells.

Cell B23= Purchase Date
Cell $E$7 = Today's date
Cell F23 = Purchase Price
Cell F24 formula needed as described below

I need to write a formula that compares the two dates and does the following.

If the Purchase date B23 is after Today's date $E$7 then show result as the Purchase price as a negative value.

If the Purchase date B23 is Today's day's date $E$7 then show result as the Purchase price as a negative value.

If the Purchase date B23 is before Today's day's date $E$7 then show the number of days difference times the Purchase price E23 as a negative value.

Any help would be greatly appreciated.
 
hi

Try :-
Code:
=-F23*IF(B23>=$E$7,1,$E$7-B23)
or
Code:
=-F23*IF(B23=>$E$7,1,DATEDIF(B23,$E$7,"d"))

hth
 
Last edited:
Upvote 0
OOPS! I left out a critical requirement.

If the Purchase date B23 is after Today's date $E$7 then the value in F24 should be the 365 times the Purchase price F23 minus the difference in the number of days.

Sorry abut that.

Cheers.
 
Upvote 0

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