Excel Calculating Average for every few numbers and skip total - excel

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.

Related

Rolling Average Excel

I am trying to find an average function that is able to automatically update when data is added in the row.
For Example: If I have to phases of data 1 & 2. 1, has less data the 2 how do I find the average function no matter the amount of data.
I have done so much research and I can not find anything
=AVERAGE(1:1) - this will give the average of all populated numeric cells in row 1. Adjust the numbers as necessary for different rows.
I'm not sure if I understand your question: you mention rolling average and in top of that you say that you want it to be filled in when a new value is added. All those things are quite obvious in Excel. There's just a part which might be confusing, and that's the part where the averages should not be calculated when no values are filled in, so I come up with the following formula (first to be filled in in B6):
=IF(NOT(ISBLANK(A6)),AVERAGE(A2:A6),"")
The rolling average is the AVERAGE(A2:A6): it calculates the average of five subsequent cells in column "A". When you drag this down, you see that it changes into:
=IF(NOT(ISBLANK(A7)),AVERAGE(A3:A7),"")
, which is again calculating the average of the last five values in column "A".
However, there's an issue: when you drag this down over the whole "B" column, you'll get wrong values for the cases where the value in column "A" is not filled in, hence the IF(NOT(ISBLANK trick: it blocks the filling of the "B" column if there's no value in "A", and you end up with something like:
Is this what you are looking for?

How can I average one row of every two columns in Excel?

Hi, I have a large dataset where I need to calculate a lot of averages. I have a large table, where every row represents a different timepoint, and every two adjacent columns are a replicate of that timepoint, which I want to calculate the average of and return it in a new table below. Basically, I want to calculate the average of the same row of two columns (i.e. C55 and D55), and put the averages in C92, then move on to the next set of two columns (i.e. E55 to and F55), put the averages in D92 and so on.
I have tried using the Offset formula, but I can't figure it out. Could someone provide me with the correct formula to plug in?
Thanks!!!
If you have Excel 365 you could use this formula in C92 to retrieve the averages for row 55:
=TOROW(BYROW(WRAPROWS(C55:H55,2),LAMBDA(r,AVERAGE(r))))
WRAPWROWS wraps the row into single rows per two columns - then it is easy to calculate the average 'BYROW'.

Excel Average based on multiple conditions

I am trying to create a formula to get the average value of one column that meets the criteria from two other columns. I have figured out a simpler one using an array, but i am attempting something more complex.
"=AVERAGE(IF((B:B="SRVC")+(B:B="TIRSVC"),E:E))" is the one I have created successfully. I am trying to add to this by also including row D and a new formula if the value is 5 or less, 6-10, 11-15 and so on to greater than 50. Any thoughts or suggestions?

Excel VBA 2010 - worksheet.subtotal function sum and average in the same row

I am creating a macro which takes data from an Oracle database, which means that the number of rows can vary depending upon the result. In this macro, I am using the worksheet.subtotal function, which sums up on a number of columns when the group changes. This all works, but the problem that I am facing are that a few of the columns need to be average.
Searching around I have not been able to find a solution where you can have both average and sum in the same row. I do not wish to have a situation where the user has to manually intervene to change each column for each group.
Is there away where you can have both average and sum in the same row?
AFAIK you cannot use both i.e Sum and Average together in Subtotal but don't loose heart :) Here is an alternative.
Let's say you have two columns. In one you want Sum and the other you want Average. In your code, set Sum for both columns. When the report is generated, simply highlight the column where you want Average and simply find and replace subtotal(9 with subtotal(1 using CTRL + H If you don't want to do it manually then you can do the Find and Replace in code as well ;)
This would work as Sum and Average have the same structure.
=Sum(<Range>)
=Average(<Range>)

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

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

Resources