I have 2 columns of numbers to be compared by the chi squared test function in Excel. This function only works correctly if all of the numbers are > 5. So I'd like to remove any rows in which one of the numbers is < 5. Filtering doesn't do it - it removes those cells from my view, but the chi-squared function still gets them. So I think I need to somehow have it copy the numbers into another location on the sheet but omitting any rows according to my criteria. Is there any automated way to do that?
Hi Mlevin,
So basically you need some automation which will remove the row containing number < 5.
Use following code to achieve this :-
Regards,Sub chk() Selection.CurrentRegion.Select Selection.Range("a1").Select While ActiveCell.Value <> "" If ActiveCell.Value < 5 Or ActiveCell.Offset(0, 1).Value < 5 Then Selection.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If Wend End Sub
DILIPandey
<click on below 'star' if this helps>
DILIPandey
+919810929744
dilipandey@gmail.com
sorry if this is a stupid question, but where does one enter this code and how does one activate it later?
Actually, if the best way is with custom code, maybe the solution is to make a chi-squared routine that just ignores such values automatically?
Hi melvin,
From Excel sheet, press Alt + F11, Insert - Module, Paste this code in right side window.
Now select your data and press Alt + F8 and run this code which must be showing there by the name of chk. Thanks.
Regards,
DILIPandey
<click on below 'star' if this helps>
DILIPandey
+919810929744
dilipandey@gmail.com
thanks!! that's great.
You are welcome...
Cheers
Regards,
DILIPandey
<click on below 'star' if this helps>
DILIPandey
+919810929744
dilipandey@gmail.com
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks