View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
macropod macropod is offline
external usenet poster
 
Posts: 329
Default equation / function question

Hi dhowell,

Try the following macro:

Sub AbsDiffs()
Dim i As Long
Dim j As Long
Dim k As Long
Dim l As Long
k = 1
With ActiveSheet
l = .Range("A65536").End(xlUp).Row
For i = 1 To l - 1
For j = i + 1 To l
.Cells(k, 3).Value = Abs(.Cells(i, 1).Value - .Cells(j, 1).Value)
k = k + 1
Next
Next
End With
End Sub

It puts the absolute differences for values in column A into column C.

Cheers

--
macropod
[MVP - Microsoft Word]


wrote in message
oups.com...
| I have a column of unique numbers in ascending order:
|
| A
| B
| C
| D
| E
| F
| etc....
|
| I would like Excel to create another column consisting of all the
| absolute differences of those numbers:
|
| IE
|
| A-B
| A-C
| A-D
| A-E
| A-F
| B-C
| B-D
| B-E
| B-F
| C-D
| C-E
| C-F
| D-E
| D-F
| E-F
|
| I don't think this should be too hard, but I don't seem to be smart
| enough to figure the syntax of the programming....
|