Automatic data but keep historic data

devmapall

New Member
Joined
Oct 6, 2020
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

A bit of a complicated one that I may just be approaching wrong. Let's use stocks as an example.

Let's say I want to pull High and Low stock price from the internet each day and have it automatically added to a table. If it changes throughout the day, I want the table to update, but then once the day is over, I want to keep whatever numbers we ended with, and on the next line, start the same process the next day. Later, I want to be able to do calculations or analysis with the numbers I've ended up with (MIN, MAX, differences, etc)

The way I've thought to do this is the following:
1) Set up a tab where I get the data from the internet. Use a Query, connected to Google, that strips the high and low price and puts it in the sheet.
2) On another tab, make my columns be High and Low price, then make my rows be the dates. Up in the corner, I put =TODAY() to have the current date on hand
3) For each cell, set up an IF function that checks if that row's date is the same as today's date. If it is, make that cell equal to the number on the chart I got from the Query. If not....and this is where I get stuck

I want the cell to update as long as the date is today's date, but once it isn't anymore, leave whatever number we ended up with. I've tried using a circular reference (and ticking the "allow" box in Options), but that's causing a different problem. Let's assume B3 is where I want my data to end up, A3 is where the date is, 'Live Data' is the tab with my Query, and A1 is where my =TODAY() function is. When I use the following:

=IF(A3=A1, 'Live Data'!D27, B3)

I get the correct numbers, updating automatically, that stop updating after the day is over. So that's good. The issue is that in trying to perform certain calculations, they don't register as their displayed value. If I do a MAX function of a range of these cells, for instance, I get the result of 0. Other calculations DO work, though; adding B3+B4 gives me the correct arithmetic result, and if I do a few cells of addition, then try to find the MAX of THOSE cells, it works. If I input the function "=B3" into D3, and "=B4" into D4, I CAN'T successfully do a MAX on D3 and D4. It gives me 0 again.

It's like it's only able to render the value as an actual value under very specific circumstances. And I have no idea why.

So A) how can I make it recognize a number as a number, and B) is there a better way to do what I'm describing a need to do?

I also don't know if this is accounted for already. Surely I can't be the first person to want a cell that waits until a certain condition is met, then stores a value and holds it even if the condition stops being met. So maybe I just don't know the function that does that.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi, I see that you want a lot of things, but you don't put any code or data example in your question. Please, put some dummy example data with the result of what you want. Also, put the website that you want to be connected to, etc.
All parameters are necessary to obtain help from this forum.
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

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