Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10
Default Excel 2003 - deleting Duplicates under conditions

Hi

I am using Excel 2003 and have a data list displaying Reference Numbers and
Test Results.

If reference numbers fail a test they will be retested until they finally
pass the test, therefore there are multiple records for these reference
number.

Once the reference number has PASSED I want to delete ALL (Pass and
Fails)occurences of this reference number.

Any ideas?

Very grateful for any suggestions.
--
Thanks
Cath
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 563
Default Excel 2003 - deleting Duplicates under conditions

Hi Cathy,
Here is a very unsophisticated macro to do the trick

Sub Tryme()
Range("A1").Select
Set myrange = Range("A2:A120")
ActiveWorkbook.Worksheets("Sheet1").Sort.SortField s.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortField s.Add Key:=myrange _
, SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("Sheet1").Sort.SortField s.Add Key:=myrange _
, SortOn:=xlSortOnValues, Order:=xlDescending,
DataOption:=xlSortNormal

With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange myrange
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Worksheets("Sheet1").Select
mylast = Cells(Cells.Rows.Count, "A").End(xlUp).Row
testID = Range("A2")
J = 1
Do While J <= mylast
If UCase(Cells(J, 2)) = "PASS" Then
myflag = True
testID = Cells(J, 1)
Range(Cells(J, 1), Cells(J, 2)) = ""
Else
If myflag And Cells(J, 1) = testID Then
Range(Cells(J, 1), Cells(J, 2)) = ""
Else
myflag = False
End If
End If
J = J + 1
Loop
Call Macro6
End Sub
Sub Macro6()
Range("A1:B120").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortField s.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortField s.Add
Key:=Range("A2:A120") _
, SortOn:=xlSortOnValues, Order:=xlAscending,
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A1:B120")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub

best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme

"Cath" wrote in message
...
Hi

I am using Excel 2003 and have a data list displaying Reference Numbers
and
Test Results.

If reference numbers fail a test they will be retested until they finally
pass the test, therefore there are multiple records for these reference
number.

Once the reference number has PASSED I want to delete ALL (Pass and
Fails)occurences of this reference number.

Any ideas?

Very grateful for any suggestions.
--
Thanks
Cath


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,081
Default Excel 2003 - deleting Duplicates under conditions

With your reference numbers in column A and test results in column B use this
in column C

=IF(SUMPRODUCT(--($A$2:$A$500=A3),--($B$2:$B$500="Pass"))0,"Delete","Keep")

Then you can filter on column C and delete the ones that say Delete


"Cath" wrote:

Hi

I am using Excel 2003 and have a data list displaying Reference Numbers and
Test Results.

If reference numbers fail a test they will be retested until they finally
pass the test, therefore there are multiple records for these reference
number.

Once the reference number has PASSED I want to delete ALL (Pass and
Fails)occurences of this reference number.

Any ideas?

Very grateful for any suggestions.
--
Thanks
Cath

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
Deleting Duplicates in Excel - Databases DColeman Excel Discussion (Misc queries) 1 March 18th 10 06:43 PM
Deleting (almost) duplicates in Excel Ken ya help? Excel Worksheet Functions 3 August 28th 09 02:37 PM
Merging duplicate entries in Excel or deleting the duplicates (Exc guinessgirl90 Excel Worksheet Functions 1 April 2nd 09 01:06 PM
Deleting duplicates in Excel Susan Woods Excel Worksheet Functions 4 May 9th 08 03:50 PM
Copying data to excel and deleting duplicates Dom Excel Discussion (Misc queries) 2 January 3rd 08 10:25 AM


All times are GMT +1. The time now is 03:24 PM.

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"