# Formula Question

#### jmharm

##### New Member
Hello,
I need help constructing an excel spreadsheet formula that will drop the two lowest numbers from each row and average the remaining total in the the final column of each row. (for grading).

Josh

### Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

#### Dave Patton

##### Well-known Member
You didn't provide sufficient information.

You can edit and/or extend the following:

=(SUM(L4:V4)-SUM(SMALL(L4:V4,{1,2})))/9

#### Chris Bode

##### Board Regular
Code:
``````Private Sub mySub()
Dim row As Integer, col As Integer
row = 1
col = 1

Dim tmp As Integer

Dim i As Integer
Dim delcol As Integer
delcol = 1

For i = 0 To 1
tmp = CInt(Sheet1.Cells(row, col).Value)
While Sheet1.Cells(row, col).Value <> ""
If tmp > CInt(Sheet1.Cells(row, col).Value) Then
tmp = CInt(Sheet1.Cells(row, col).Value)
delcol = col
End If
col = col + 1
Wend

Sheet1.Columns(delcol).Delete
Next

col = 1
Dim sum As Integer
sum = 0
Dim avg As Double
avg = 0
While Sheet1.Cells(row, col).Value <> ""
sum = sum + Sheet1.Cells(row, col).Value
col = col + 1
Wend

avg = sum / col
Sheet1.Cells(row, col).Value = avg

End Sub``````

Thanks!

Replies
6
Views
124
Replies
4
Views
531
Replies
0
Views
215
Replies
4
Views
419
Replies
0
Views
161

1,191,200
Messages
5,985,236
Members
439,953
Latest member
suchitha

### 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.

### Which adblocker are you using?

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

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