Stopping a day count through an IF formula

Stclements1

Board Regular
Joined
Sep 15, 2018
Messages
147
Office Version
  1. 365
Platform
  1. Windows
I am looking for a formula that can stop a day count if a number is posted in another cell.
I open trades and in cell D2 I add the date the trade was executed. In cell E2 I have the formula =today() which will give me the current days date. in cell f2 I take the value in cell d2 (execution date from cell e2 current date. This gives me the days the trade has been open.
In cell b2 I have the numeral 1, this indicated that the trade is open and in cell c2 if have the following formula=IF(B2>0;0;1). This means when when I close the trade I put a 0 in cell b2 which will then through the formula in cell c2 put a 1 in cell c2.
What I would like to do if possible is stop the day count in E2 so it no longer updates the current date but stops the day count when the value in cell c2 is 1 which implies the trade has been closed.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
In E2 put
VBA Code:
=IF(C2<>1,TODAY(),"")
 
Upvote 0
Oh okay, I have tried it and many thanks for your time the only problem I have is that when the trade is closed 0 is entered into cell b2 which in turn puts the number 1 in cell c2 which in turn deletes the date in cell e2 which then deletes the value in cell F2 which calculates the days between the dates of the opening of the trade in cell d2 and the closing of the trade in cell e2. What I was hoping to achieve is that whilst the trade is open cell e2 will operate with the formula =today() but when I close the trade by having the value as 1 in cell c2 cell e2 will lock in the date at the time of the closing the trade but count no further days thereafter but display the date of closing.
 
Upvote 0
Oh okay, I have tried it and many thanks for your time the only problem I have is that when the trade is closed 0 is entered into cell b2 which in turn puts the number 1 in cell c2 which in turn deletes the date in cell e2 which then deletes the value in cell F2 which calculates the days between the dates of the opening of the trade in cell d2 and the closing of the trade in cell e2. What I was hoping to achieve is that whilst the trade is open cell e2 will operate with the formula =today() but when I close the trade by having the value as 1 in cell c2 cell e2 will lock in the date at the time of the closing the trade but count no further days thereafter but display the date of closing.
Out of my league, maybe one of the formula gurus can help.
Regards, JLG
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,974
Members
448,537
Latest member
Et_Cetera

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