Fetching data based on conditions

MoneyPlanters

New Member
Joined
Apr 9, 2011
Messages
41
Please have a look at the image.
Col A contains names of stock exchanges.
Col B contains dates.
Col C, D, E and F contain data that we shall be using. Col G and H are not required.

Every day one such file shall be imported from the internet and the newer file will always keep adding (appending) data to the existing one. For example if the screenshot is considered to be taken from a file that was downloaded today, a file downloaded 7 days later will contain more data than this one plus whatever this one has.

Now we need to achieve the following :

If col A is 'CAC40' then pick the OHLC (stands for Open, High, Low, Close; present in Col C through F) values that correspond to the latest date available and paste them in L824, M824, N824, O824.

Similarly, If col A is 'COMP' then pick the OHLC (stands for Open, High, Low, Close; present in Col C through F) values that correspond to the latest date available and paste them in L825, M825, N825, O825.

And so on.. till all the markets are covered. There are 15 of them.

How can we achieve this ? Kindly help.
Thank you.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
You should be able to use the example below.

Excel Workbook
ABCDEFGHIJKL
1TickerDate/TimeOpenHighLowClose**OpenHighLowClose
2CAC4001-Jan2688414037881774*CAC4013632109001620216463
3CAC4002-Jan322647118003622*COMP19092124311622220508
4CAC4003-Jan73761582877******
5CAC4004-Jan177018481584481******
6CAC4005-Jan121053533912992******
7COMP01-Jan467617491983599******
8COMP02-Jan1898239249683320******
9COMP03-Jan294916182966878******
10COMP04-Jan27776253672269******
11COMP05-Jan2791275621663725******
Sheet1
#VALUE!
</td></tr></table></td></tr></table>
 
Upvote 0
You can click on the image and that should open a large copy of the image.
Ok...

Enter this formula in L824:

=INDEX(C$811:C$1000,MATCH($K824,$A$811:$A$1000,0)+COUNTIF($A$811:$A$1000,$K824)-1)

Copy across to O824 then down as needed.

Adjust for a reasonable end of range, row 1000.
 
Upvote 0
Thank you so much njimack and T. Valko.

Something just struck me.. that is.. this file will get progressively heavier, since everyday, new data will be appended to it and will make it more complicated. What we could do is, delete all data which are more than a year old and then run the above formulae.. that should make it more easier.

Is that doable ? Do we need any modifications in the formulae for this ?
 
Upvote 0
Thank you so much njimack and T. Valko.

Something just struck me.. that is.. this file will get progressively heavier, since everyday, new data will be appended to it and will make it more complicated. What we could do is, delete all data which are more than a year old and then run the above formulae.. that should make it more easier.

Is that doable ? Do we need any modifications in the formulae for this ?
That would certainly help make the formulas more efficient since the size of the calculated range will be reduced.

If you simply delete the data then you'll have to update the range references in the formulas.
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,794
Members
452,943
Latest member
Newbie4296

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