Updating data if it is today(), and leaving data if its not

cbubb70

New Member
Joined
Dec 11, 2021
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
I have a series of dates down the page and the next cell is a stock price (pulled with an API token)

12/10/2021 =IF(B331=TODAY(),WEBSERVICE(CONCATENATE("https://cloud.iexapis.com/stable/stock/",$C$11,"/quote/latestPrice?token=",Crypto!J3)),C331)
12/11/2021 =IF(B332=TODAY(),WEBSERVICE(CONCATENATE("https://cloud.iexapis.com/stable/stock/",$C$11,"/quote/latestPrice?token=",Crypto!J3)),C332)
12/12/2021 =IF(B333=TODAY(),WEBSERVICE(CONCATENATE("https://cloud.iexapis.com/stable/stock/",$C$11,"/quote/latestPrice?token=",Crypto!J3)),C333)
12/13/2021 =IF(B334=TODAY(),WEBSERVICE(CONCATENATE("https://cloud.iexapis.com/stable/stock/",$C$11,"/quote/latestPrice?token=",Crypto!J3)),C334)
etc

I want to insert a formula that if the date is today() it will perform the formula, but if it isn't (past or future date) it will leave the cell data alone.

Basically, I want to have it automatically fill in the stock price for the date, but then I want it to keep the historical data from previous dates after that date has passed.

I have included the formula to capture the data (stock prices) for each date, but when i try previous dates, it changes the values to 0.

Can anyone help with what I'm doing wrong to keep the historical data?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
I have a series of dates down the page and the next cell is a stock price (pulled with an API token)

12/10/2021 =IF(B331=TODAY(),WEBSERVICE(CONCATENATE("https://cloud.iexapis.com/stable/stock/",$C$11,"/quote/latestPrice?token=",Crypto!J3)),C331)
12/11/2021 =IF(B332=TODAY(),WEBSERVICE(CONCATENATE("https://cloud.iexapis.com/stable/stock/",$C$11,"/quote/latestPrice?token=",Crypto!J3)),C332)
12/12/2021 =IF(B333=TODAY(),WEBSERVICE(CONCATENATE("https://cloud.iexapis.com/stable/stock/",$C$11,"/quote/latestPrice?token=",Crypto!J3)),C333)
12/13/2021 =IF(B334=TODAY(),WEBSERVICE(CONCATENATE("https://cloud.iexapis.com/stable/stock/",$C$11,"/quote/latestPrice?token=",Crypto!J3)),C334)
etc

I want to insert a formula that if the date is today() it will perform the formula, but if it isn't (past or future date) it will leave the cell data alone.

Basically, I want to have it automatically fill in the stock price for the date, but then I want it to keep the historical data from previous dates after that date has passed.

I have included the formula to capture the data (stock prices) for each date, but when i try previous dates, it changes the values to 0.

Can anyone help with what I'm doing wrong to keep the historical data?
You can't do that with excel formula, VBA would be needed.
 
Upvote 0

Forum statistics

Threads
1,214,789
Messages
6,121,590
Members
449,039
Latest member
Arbind kumar

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