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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Cf. post #5, column B (just the input data is different to what you posted later).
Hmmmmm it does not seem to be working, "VSTACK" and "SEQUENCE" as functions do not appear to work? If I could attach a screenshot I would but it says that the image is too large!
 
Upvote 0
I am not sure about VSTACK but SEQUENCE should definitely work in Excel 2024. The following should hopefully work in 2024 but the question above persists:

Excel Formula:
=LET(
a,A1:A13,
b,SEQUENCE(ROWS(a)),
IFERROR(IF(ISEVEN(b),(INDEX(a,b-1,0)+INDEX(a,b+1,0))/2,NA()),""))

If you replace "" with a at the end it will return the original values too.
 
Upvote 0
I am not sure about VSTACK but SEQUENCE should definitely work in Excel 2024. The following should hopefully work in 2024 but the question above persists:

Excel Formula:
=LET(
a,A1:A13,
b,SEQUENCE(ROWS(a)),
IFERROR(IF(ISEVEN(b),(INDEX(a,b-1,0)+INDEX(a,b+1,0))/2,NA()),""))

If you replace "" with a at the end it will return the original values too.
There is an odd number in the data set so that should be ok. Thank you for your help. Bit worried about the SEQUENCE and LET commands, I will run any updates on excel that I have not completed and then go again and let you know how I get on
 
Upvote 0
VSTACK is available in 2024. The issue is your data set looks like text and not number due to the °C symbols. There needs to be further manipulation.
Book2
AB
119.742 °C 
219.1805
318.619 °C
418.4905
518.362 °C
618.336
718.310 °C
818.296
918.282 °C
1018.278
1118.274 °C
1218.298
1318.322 °C
Sheet2
Cell Formulas
RangeFormula
B1:B13B1=IF(ISEVEN(SEQUENCE(ROWS(A1:A13))),VSTACK("",(TEXTBEFORE(A1:A12,"°C")+TEXTBEFORE(A3:A14,"°C"))/2),"")
Dynamic array formulas.
 
Upvote 0
Excel Formula:
=LET(
    x, B2:B30,
    MAP(x = "", SEQUENCE(ROWS(x)), LAMBDA(a,b, IF(a, AVERAGE(INDEX(x, b - 1), INDEX(x, b + 1)), INDEX(x, b))))
)
1734902805959.png
 
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,325
Members
453,032
Latest member
Pauh

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