Averaging data in a dataset

ZochSteveo

New Member
Joined
Dec 21, 2024
Messages
9
Office Version
  1. 2024
Platform
  1. MacOS
Hi everyone,

I was wandering if somebody could help me. I am currently doing some stitching for a dataset I have been given for my dissertation.

The data essentially is formatted like this with the following temperatures as an example:

17.1 in the first cell
13.2 in the third cell
14.5 in the fifth cell

What I then wanted was for the second cell to contain the average of the first and third and then the fourth cell to contain the average of the third and fifth etc.

I thought I had figured out how to average the first and third and third and fifth etc for the whole dataset as I need to find the average for each of the middle cells. The dataset is very large so would take far too long to do by hand. Like I said, I thought I had managed it originally but now it is coming up with an error message.

Please if anyone knows the solution, let me know :)
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hello, maybe something along these lines?

Excel Formula:
=LET(
a,A1:A10,
b,SEQUENCE(ROWS(a)),
IFERROR(IF(ISEVEN(b),(INDEX(a,b-1,0)+INDEX(a,b+1,0))/2,NA()),""))
 
Upvote 0
Hello, maybe something along these lines?

Excel Formula:
=LET(
a,A1:A10,
b,SEQUENCE(ROWS(a)),
IFERROR(IF(ISEVEN(b),(INDEX(a,b-1,0)+INDEX(a,b+1,0))/2,NA()),""))
Thank you, can this be input into excel or does it have to be coded into the software? It appears to be code, which at this moment I am not currently using
 
Upvote 0
It is an Excel formula so just select a cell where you want the output and then select the range where is your data.
 
Upvote 0
Not sure how you want to handle the last average cell where you have even # of rows. Another option:
Book2
ABCDE
1Even Rows CaseOdd Rows Case
22 2 
352.552.5
433
547.547.5
61212
726
Sheet1
Cell Formulas
RangeFormula
B2:B7B2=IF(ISEVEN(SEQUENCE(ROWS(A2:A7))),VSTACK("",(A2:A6+A4:A8)/2),"")
E2:E6E2=IF(ISEVEN(SEQUENCE(ROWS(D2:D6))),VSTACK("",(D2:D5+D4:D7)/2),"")
Dynamic array formulas.
 
Upvote 0
It is an Excel formula so just select a cell where you want the output and then select the range where is your data.
Would I be able to type it in for one cell and then click and drag it down? Hang on, let me attack a little spread sheet so that you have a better idea of what it is I am dealing with as I am a little bit confused at the moment. Attached below is the code, as you can see I have left a space in between for the averages of the two numbers and I need to do this for a vast dataset. Please could you assist with this bit as I think I have misunderstood how to do it.

Example for Questions.xlsx
A
119.742 °C
2
318.619 °C
4
518.362 °C
6
718.310 °C
8
918.282 °C
10
1118.274 °C
12
1318.322 °C
Sheet1
 
Upvote 0
Not sure how you want to handle the last average cell where you have even # of rows. Another option:
Book2
ABCDE
1Even Rows CaseOdd Rows Case
22 2 
352.552.5
433
547.547.5
61212
726
Sheet1
Cell Formulas
RangeFormula
B2:B7B2=IF(ISEVEN(SEQUENCE(ROWS(A2:A7))),VSTACK("",(A2:A6+A4:A8)/2),"")
E2:E6E2=IF(ISEVEN(SEQUENCE(ROWS(D2:D6))),VSTACK("",(D2:D5+D4:D7)/2),"")
Dynamic array formulas.
Would I be able to type it in for one cell and then click and drag it down? Hang on, let me attack a little spread sheet so that you have a better idea of what it is I am dealing with as I am a little bit confused at the moment. Attached below is the code, as you can see I have left a space in between for the averages of the two numbers and I need to do this for a vast dataset. Please could you assist with this bit as I think I have misunderstood how to do it.

Separated Data.xlsx
B
219.742 °C
3
418.619 °C
5
618.362 °C
7
818.310 °C
9
1018.282 °C
11
1218.274 °C
13
1418.322 °C
Sheet2


I have sent this to both of you so hopefully one of you has a solution
 
Upvote 0
Both of those formulas are single cell formulas, i.e. there is no need to drag anything down, only to place it in C2 and then select the range with the data, e.g. from B2:B14. Also, as @Cubist pointed out, the question is how the last average is to be calculated when there is even # of rows.
 
Upvote 0
Both of those formulas are single cell formulas, i.e. there is no need to drag anything down, only to place it in C2 and then select the range with the data, e.g. from B2:B14. Also, as @Cubist pointed out, the question is how the last average is to be calculated when there is even # of rows.
Is there any chance you could upload this onto a mini spreadsheet just so I can see it visually? I really appreciate all of your help, but I appear to be struggling to get the formula to work as you describe. Many thanks for all of your support, I really do appreciate it :)
 
Upvote 0

Forum statistics

Threads
1,224,837
Messages
6,181,255
Members
453,028
Latest member
letswriteafairytale

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