JamesHayek
New Member
- Joined
- May 24, 2016
- Messages
- 20
Hello All, hope all is well!
I had an issue where I needed to filter the highest value, given a set.
That set was defined by rows equaling each other. For any given lat/long/timestamp I am given up to five values.
I have used a function to identify which item in each set has the highest value. This works.
The function is:
I wrote a VBA to automate it. It worked initially, then started to freeze my unit. I am not sure why.
I have tried to include a test file, but .CSV and .ZIP files are not uploadable. So, I pasted a link below the code.
Any help would be greatly appreciated.
CSV File
I had an issue where I needed to filter the highest value, given a set.
That set was defined by rows equaling each other. For any given lat/long/timestamp I am given up to five values.
I have used a function to identify which item in each set has the highest value. This works.
The function is:
VBA Code:
=IF(F13=MAX(IF($A:$A=A13, $F:$F)), "Yes", "No")
I wrote a VBA to automate it. It worked initially, then started to freeze my unit. I am not sure why.
I have tried to include a test file, but .CSV and .ZIP files are not uploadable. So, I pasted a link below the code.
Any help would be greatly appreciated.
VBA Code:
Sub FilterRSRP_From_CSV()
Application.ScreenUpdating = False
Application.DisplayAlerts = False 'switching off the alert button
ActiveSheet.Name = "OriginalData"
Range("I8").Select
Selection.FormulaArray = "=IF(RC[-3]=MAX(IF(C1=RC[-8], C6)), ""Yes"", ""No"")"
Selection.AutoFill Destination:=Range("I8:I30000"), Type:=xlFillDefault
Range("I8:I50000").Select
Columns("I:I").Select
Selection.AutoFilter
ActiveSheet.Range("$I$1:$I$50000").AutoFilter Field:=1, Criteria1:="Yes"
Cells.Select
Range("L19").Activate
Selection.Copy
Sheets.Add After:=ActiveSheet
ActiveSheet.Name = "FilteredData"
ActiveSheet.Paste
Application.CutCopyMode = False
Columns("I:I").Select
Selection.Delete Shift:=xlToLeft
Worksheets("OriginalData").Delete
ActiveWorkbook.Save
Workbooks.Close
End Sub
CSV File