How to convert 1min OHLC data into 5min OHLC data - excel

I'm trying to convert 1 minute OHLC (Open/High/Low/Close) data into 5 minute OHLC data in Excel 2013. So far I know the principle. Open has to take the open value every 5 rows, similarly for Close. Min/Max is also understandable. Unfortunately Excel can't understand that I want to get Min/Max from rows 0-5, 5-10 etc. it goes 0-5, 1-6, 2-7 etc.
I was also trying to use AVERAGE somehow but it's pointless since its output doesn't correspond with reality at all. From some more research I think I will have to create a macro from functions AVERAGE, OFFSET, INDEX and MATCH and that's where my struggle begins. I have no idea how to construct that formula.
Here's a picture of how it looks after using Filter on the Count Column:

Add a column (assumed to be A) on the left with 0 as a label and =IF(MOD(B2,6)=0,1+A1,A1) in A2 copied down. Subtotal for each change in 0 and use Count on all the other columns. Change the first subtotal row formulae to be:
ColumnC: =C2
ColumnD: =SUBTOTAL(4,D2:D6)
ColumnE: =SUBTOTAL(5,E2:E6)
ColumnF: =F6
Filter for ColumnA contains c and copy formulae down.
Edit

pandas library of Python would do it easily. Give it a try

Related

Convert [Days, hh:mm:ss] to [hh:mm:ss]

Some data i export to Excel appears like this: '3 Days, 2:15:37' (when the period exceeds 24 hours only, [hh:mm:ss] otherwise, which is ok).
How can i display it on Excel as [hh:mm:ss] even when it exceeds 24 hours?
Maybe you'll find a better method, but here's one method that involves using some helper columns. Since your column is of General format, then it's going to recognize some of your cells as Time except for those with "Days". You have a mixture of formats so it's a but cumbersome.
You can probably consolidate a couple steps here, but breaking it out better identifies a process. Column A is your original data.
Column B: Formula to extract data to the right of "comma space":
=IFERROR(MID(A2,FIND(",",A2)+2,10),A2)
Column C: For cells containing the word "Day", take the value to the left of it and multiply by 24.
=IFERROR(LEFT(A2,FIND("Day",A2)-1)*24,0)
Column D: Extract the HOURS from your time format of column B.
=HOUR(B2)
Column E: Take the MM:SS from column B.
=TEXT(B2,"mm:ss")
Column F: Put it all together:
=CONCAT(C2+D2,":",E2)
Here's one way to combine the last two steps, which would reduce the number of helper columns by one.
=CONCAT(C2+D2,":",TEXT(B2,"mm:ss"))

Excel Calculating Average for every few numbers and skip total

In excel, I need to calculate average in column B for every few data thats in Column A but need to skip total. But column A doesnt have a consistent sequence. Is it possible to do sth like the picture? I have 100k+ records so doing it manually is not very efficient. Please advise if there a way doing it, thanks
The logic is that First Average number is based on B2:B6, second average is B8:B11 that is skipping all the "total"
Use INDEX/MATCH
=IF(OR(A1="TOTAL",ROW()=2),AVERAGE(B2:INDEX(B2:B$1040000,MATCH("TOTAL",A2:A$1040000,0)-1)),"")
Put that in C2 and copy down the dataset.

excel sumproduct formula calculating time

hello dear forum members and admins,
i created a dashboard to calculate customer numbers based on raw data prepared on day and time set.
there is no problem here I can calculate. but I also want to calculate the monthly average customer numbers based on the time set. for this purpose, I created a data table in a daily_pax_sheet. for e.g in January between 10:00 - 10:30 CUSTOMERS E totally number is 35 and this 35 amount occurred in 8 days, then it calculates 4 amounts. in daily_pax_details sheet row 107 formula firstly calculate sum of the data then it divides the day number (for e.g this amount occurs in 8 days) but in some cases, raw data include more than 20k line and it's calculating and waiting too much. is there any other way to do it in a quick way ? how can I change this formula to make calculation quick ?
https://docs.google.com/spreadsheets/d/1y-2Ke2ssskzSM-wYszU54CIEraPbEX4X/edit#gid=459027650
UPDATE: thanks for the idea and solution from members
I also realized another solution and I think it will help other people in the future. we can get the data to the pivot table with counting the unique values with changing field settings. To do it you should get the data pivot table with selecting "add this data to the data model". then changing value field settings with the "Distinct value". hope it will help another pppl.
Your SUMIFS formulas use whole columns as criteria, so every calculation checks more than 1 million cells. And because you use more than 1 column, then every time you update *anything in the file, Excel checks more than 4 million cells because of your formulas...
I changed all to use the righ rawdata range of cells used, not whole columns. And now it works perfect.
As example, your formula is:
=SUMIFS('raw data'!$R:$R;'raw data'!$D:$D;'Daily customer'!C$3;'raw data'!$I:$I;'Daily customer'!$A4)
And I changed to:
=SUMIFS('raw data'!$R$2:$R$2461;'raw data'!$D$2:$D$2461;'Daily customer'!C$3;'raw data'!$I$2:$I$2461;'Daily customer'!$A4)
Because in your sheet raw data your data goes from row 2 to 2461, so in every calculation Excel checks only 2460 cells, not 1 million....
Change all your formulas like this and you should notice a better performance indeed.
UPDATE: I've uploaded the modified file: https://docs.google.com/spreadsheets/d/11isonBHFJTFFWtZTJg66JHbtyrD0XFGl/edit?usp=sharing&ouid=114417674018837700466&rtpof=true&sd=true
It works smoothly for me. No lag or anything. I can change any cell value, move the graph, filter cells and everything is done almost instantly.

Excel Data Entry made faster with Macro?

I am currently trying write a macro in excel to help shorten the time that this will take. I have water sample data for 10 different manholes and each were sampled quarterly since 1994. Because of this, I have a total of 75 dates that I need to input per manhole for this spreadsheet. Each of these dates has 97 rows of information that is input into this sheet and then a space before going to the next date. My ultimate question is, how can I take the dates shown from the first image and copy the first one 97 times, then second 97 times without redundantly doing so. Example is the image attached.
In column A have an integer sequence, starting at 0 and going up. In column B, do integer division on column A (QUOTIENT). You'll integer divide by the number of times you want things repeated (97). Then in column C, use VLOOKUP, taking the value from column B as the index into your lookup table, to "copy" the values for dates.
If you have the same measurements for each date, you can use a new column that uses MOD on column A, then use that as the index for a second VLOOKUP into your measurements lookup table.

Need light formula to get some counts in large data sheet

I have an employee data base that contains names and 8 movement types (Ex. Recruitment, Resignation....etc). Also I have starting head counts.
What I need to do is calculating movement counts and head counts based on the month for 12 months. Currently i am using SUMIF formula to calculate all these and the thing is excel will be very slow with all formulas. Appreciate if anyone can help me on this. See the image below for sample of the formula and I need to insert this formula in more than 600 lines.
A pivot table would be a good way to go, but by the look of your criteria you'll need to create 'helper columns' to ensure your data is ready for aggregation in a Pivot table.
For instance in your master data tab, add a new column called 'MatchesCriteria' or words to that effect, and build a formula in that column that checks for all of the criteria that you want to have the report based on, and returns a 1 or a 0, e.g.
=IF( (IF(C2="Recruitment",1,0)+IF(D2="Secondment In",1,0)) > 0 , 1 , 0)
Then run a pivot table including the 'Plant' column in your Rows, the month column in your columns and the 'MatchesCriteria' in your data values, and switch the calculation type to 'SUM' rather than 'COUNT'.
This will do the trick and will refresh in a flash compared to evaluating all of those countif statements.

Resources