Removing rows after a calculation

rhino4eva

Active Member
Joined
Apr 1, 2009
Messages
262
Office Version
  1. 2010
Platform
  1. Windows
i have tried this on the boards b4, i may not have explained my probelm in a way that people understood. so i'll give it another try

i have a sheet that can vary in length
it is numerical data from an analyser i use
i need a macro that is able to scan down colunm "a" and calculate the average value for that column
i then need it to be able to delete any entries in column a that are less then 90% of the average

i have tried all sorts and am at my witts end :confused: :confused: if any can help i would be really grateful
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
thanks for looking at my post.
i would like to delete the entire row
 
Upvote 0
Dim i As Long
Dim LASTROW As Long
Dim c As Range, rng

Dim avg1 As Double

LASTROW = Cells(Rows.Count, 1).End(xlUp).Row

avg1 = WorksheetFunction.Average(Range("a1:a" & LASTROW))
avg1 = avg1 * 0.9

' ** Deletes rows where col A value < avg1"
For i = LASTROW To 1 Step -1
If Range("A" & i).Value < avg1 Then Range("A" & i).EntireRow.Delete Shift:=xlUp

Next i
 
Upvote 0
Thank you SteveO59L is works a treat . i was working from top downand it wasnt working . Your code works from last entry up .......... inspired:biggrin:
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,519
Members
452,921
Latest member
BBQKING

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top