Midpoint of list of numbers

markdwalls

New Member
Joined
May 15, 2018
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm currently looking for a formula which find the midpoint of a two numbers and return the midpoint whilst maintaining the original numbers as well. Apologies if that explanation isn't very good. Below is a screenshot of what i'm trying to do. Column C is the raw data that i have reported. Column Q is an example of what i need the formula to return. In theory, the list of numbers in column Q should be twice as long as the list in column C.

Thanks in advance

1626078865677.png
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Upvote 0
A very brief VBA solution with the same data in col C - no helper column needed - which could be enhanced to be more extensible, handle the last value more elegantly, or whatever:

VBA Code:
Sub midpoints()
qr = 2
For n = 2 To 6
    f = Cells(n, 3)
    s = Cells(n + 1, 3)
    m = (f + s) / 2
    Cells(qr, 17) = f
    If n <> 6 Then Cells(qr + 1, 17) = m
    If n <> 6 Then Cells(qr + 2, 17) = s
    qr = qr + 2
Next n
End Sub

Output:
Book2
CQ
1CQ
226002600
32609.8832604.942
42619.8822609.883
52630.0242614.883
62639.8712619.882
72624.953
82630.024
92634.948
102639.871
Sheet1
 
Upvote 0
A very brief VBA solution with the same data in col C - no helper column needed - which could be enhanced to be more extensible, handle the last value more elegantly, or whatever:

VBA Code:
Sub midpoints()
qr = 2
For n = 2 To 6
    f = Cells(n, 3)
    s = Cells(n + 1, 3)
    m = (f + s) / 2
    Cells(qr, 17) = f
    If n <> 6 Then Cells(qr + 1, 17) = m
    If n <> 6 Then Cells(qr + 2, 17) = s
    qr = qr + 2
Next n
End Sub

Output:
Book2
CQ
1CQ
226002600
32609.8832604.942
42619.8822609.883
52630.0242614.883
62639.8712619.882
72624.953
82630.024
92634.948
102639.871
Sheet1
Thank you very much!
 
Upvote 0
See if this helps. I don't think that it will be possible to do it straight into a single column. If it can be done then it will likely require something ludicrously long and complicated.
Cell Formulas
RangeFormula
B3:B6B3=MEDIAN(A2,A3)
C2:C10C2=SMALL($A$2:$B$6,ROWS(C$2:C2))
Thank you very much. Much appreciated
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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