Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Herbert Seidenberg
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Columns FemIce Excel Discussion (Misc queries) 1 September 28th 05 09:29 AM
can't insert columns between columns smooth operator Excel Discussion (Misc queries) 1 May 1st 05 10:53 PM
Clearing information in certain columns jolly_lolly Excel Discussion (Misc queries) 1 April 22nd 05 02:41 AM
Removing Near-Duplicate Rows, Leaving Those w/Most Data in Specific Columns foofoo Excel Discussion (Misc queries) 1 April 2nd 05 12:02 AM
Columns in Excel will not allow user to click in them Kim Excel Discussion (Misc queries) 1 December 28th 04 06:37 PM


All times are GMT +1. The time now is 12:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"