Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
If you want Excel to do the operation automatically,
just code it as VBA. Sub fitLS() Dim lengthA As Integer Dim lengthB As Integer Dim Cull As Single Dim Fit1 As Single Dim Fit2 As Single Dim Fit1B As Single Dim Fit2B As Single Dim kg As Integer lengthB = Range("Bcol").Count 'length of B For kg = 1 To lengthB - 1 'for each B Cull = Range("Acol").Cells(kg, 1) 'store A cull Fit1 = Range("FitAB").Cells(kg, 1) 'store fit Fit2 = Range("Sumfit") 'store least squares lengthA = Range("Acol").Count 'new length of A Range("Acol").Range(Cells(kg + 1, 1), Cells(lengthA, 1)).Copy _ Range("Acol").Range(Cells(kg, 1), Cells(lengthA - 1, 1)) 'shift up, Range("Acol").Cells(lengthA, 1).ClearContents 'same as delete Fit1B = Range("FitAB").Cells(kg, 1) 'store new fit Fit2B = Range("Sumfit") 'store new least squares If Fit1B Fit1 Or Fit2B Fit2 Then 'if delete of A doesn't help Range("Acol").Range(Cells(kg, 1), Cells(lengthA - 1, 1)).Copy _ Range("Acol").Range(Cells(kg + 1, 1), Cells(lengthA, 1)) 'shift down Range("Acol").Cells(kg, 1) = Cull 'restore A cull End If Next kg End Sub On your spreadsheet, add this formula =SQRT(SUM(FitAB)) and name it Sumfit |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Columns | Excel Discussion (Misc queries) | |||
can't insert columns between columns | Excel Discussion (Misc queries) | |||
Clearing information in certain columns | Excel Discussion (Misc queries) | |||
Removing Near-Duplicate Rows, Leaving Those w/Most Data in Specific Columns | Excel Discussion (Misc queries) | |||
Columns in Excel will not allow user to click in them | Excel Discussion (Misc queries) |