How can I average one row of every two columns in Excel? - 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'.

Related

How can I write an excel formula to count the number of times values in two separate columns are the same on the same row

I have two separate columns in an excel spreadsheet calculating gambling profits
when a free bet is placed, the total payout column and the total won column will be the same
i want to write an excel formula that will count how many times these two columns have the same value within the same row
I was able to use COUNTIF and COUNTIFS formulas for everything else I was trying to accomplish, but I can not figure this one out
thank you
Using SUMPRODUCT and the double unary --:
=SUMPRODUCT(--(B2:B5=D2:D5))

Calculate the average of columns, then remove the columns using Google Spreadsheet

I have a data set in a Google Spreadsheet with each column representing a year. The data I want from this spreadsheet is the average over five years, so I create a column for each five year interval containing the average (calculated with =AVERAGE(B2:F2) for the second row and first interval). Now I do not want the columns with specific years when I create a .csv file of the data and use it in my program, but only the columns containing the average. If I remove those columns that I don't want I will get an error saying that elements are missing.
Is there a way, in Google Spreadsheet, to "save" the calculated average (or any function for that matter) in the column so that it only contains a single numeric value and has no dependencies?
If i'm understanding your question correctly, you could highlight all the cells with the averages, copy and paste special - values. that would remove all the formulas you have in those cells but would keep the values when you delete the data columns.

Calculation of two cells in a COUNTIF

I have an Excel document with two date columns and a column with four possible values. I need to filter for one value on the last column. Then I need to calculate the days between the two dates for all the values that are left and count the times that those days are between 0 and 30.
I know how to filter and I know how to calculate the days between two dates. I also know how to count the times those days are between 0 and 30.
I cannot figure out how to put it all together without making a simple calculation in another sheet and hide it.
No longer needed. I found out how to pull the data from Google Analytics with some VBA code.

Getting average of data with multiple entries for a single date using pivot table in Excel

I have tried this, but I am unsuccessful. I have the data dump in an excel sheet (Excel 2010). The first column has month. The second has the dates. The third column has numerical data. I have applied filters on each column to get the data on the Pivot Table. There are entries for each date. There are sometimes multiple entries for a single date. Now, when I run the Pivot, I get the proper sum, but when I select average, the average is accurate only for the single entries associated with a date. I need to calculate average of multiple data entries for a single date. Here is an example:
November 11/1/13 30
November 11/2/13 25
November 11/3/13 20
November 11/3/13 25
Now, when I run the Pivot table and select to average the data, it calculates the average as (30+25+20+25)/4 = 20 (since there are 4 entries, so the sum gets divided by 4).
This is not desirable.
I require the calculation to be made as taking the 3rd and 4th entry as one for the date 11/3/13. So, the required output is (30+25+(20+25))/3 = 33.33.
I hope the example gives an clear idea of the requirement. I need a solution for this. How do we modify the Pivot so that the average is calculated not based on just the number of entries, but the average is calculated for the number of days.
Create the pivot table described by Ron (with Sum only, not Average), then copy & paste special (values) this pivot table, then pivot that for averages.
Put your dates in the "Row Labels" area. It will Sum and Average by Date
Edit: To get the average of the sum of the daily values, you can either enter an Average formula someplace for the Pivot Table Sum Column, or you could use the following array-entered formula:
=SUM(Values)/SUM(1/COUNTIF(Dates,Dates))
Where Dates is the range where you have your list of Dates (on the original data sheet) and Values is the range where you have your original list of Values.
To array-enter a formula, after entering
the formula into the cell or formula bar, hold down
while hitting . If you did this
correctly, Excel will place braces {...} around the formula.
SUM(1/COUNTIF(Dates,Dates)) will return a count of the Unique dates, so it will return 3 for the dates in question in your example.
This proposed solution uses a working column named: Value (U)
Assuming that your data is located at [B4:B8].
Add a working column at [E4:E8]
Enter this formula at [E5:E8]:
= IF( COUNTIF($C$5:$C5,$C5) > 1, 0,
SUMIF($C$5:$C$8,$C5,$D$5:$D$8) )
Then use the working column Value (U) to sum and average the values, also add Value (U) as Page Field to filter out the Value (U)=0.

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>)

Resources