Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Deleting Duplicates BUT with a twist

What I am trying to solve is the following.

A | B
---------------------
SOIL NAME LOCATION
JY1 | L
HG | L
AT | B
AT | B
LS | L
PR | S
JY1 | S
JY1 | B
PR | B
Result I am aiming for is:
A | B | C | D | E | F |
LOCATION L B S
SOIL NAME
JY1 YES YES YES
HG YES
AT YES
LS YES
PR YES YES

What I want to be able to do is to remove all duplicate
soil names eg all JY1, so that only one is listed, but
check the information to the right of it & if it is
different add it next to the one that is kept. I suppose
its like a pivot table, but I want to be able to run a
macro to do this.

help needed. I have written code that can automatically
delete duplicates, but I dont know how to do the rest.

Kind regards

John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Deleting Duplicates BUT with a twist

John

Don't know if the first reply didn't make it or the newsgroup update is slow. Try the following.

Tony

Sub bbb()
Dim soilname As New Collection
Dim locs As New Collection

'get unique soilnames
On Error Resume Next
For Each sn In Range("a3:a11")
soilname.Add sn.Value, sn.Value
Next sn

'get unique locations
For Each Lo In Range("b3:b11")
locs.Add Lo.Value, Lo.Value
Next Lo

On Error GoTo 0
'output headings
Range("g14").Value = "Location"
Range("g15").Value = "Soil Name"

'output unique values
Range("h14").Select
For Each Lo In locs
ActiveCell.Value = Lo
ActiveCell.Offset(0, 1).Select
Next Lo

Range("g16").Select
For Each sn In soilname
ActiveCell.Value = sn
ActiveCell.Offset(1, 0).Select
Next sn

'put in formulas
Range("h16").Formula = "=IF(SUMPRODUCT(--($A$3:$A$11=$G16),--($B$3:$B$11=H$14)),""YES"","""")"
Range("h16").Copy Destination:=Range("h16:j20")

End Sub


----- John Young wrote: -----

What I am trying to solve is the following.

A | B
---------------------
SOIL NAME LOCATION
JY1 | L
HG | L
AT | B
AT | B
LS | L
PR | S
JY1 | S
JY1 | B
PR | B
Result I am aiming for is:
A | B | C | D | E | F |
LOCATION L B S
SOIL NAME
JY1 YES YES YES
HG YES
AT YES
LS YES
PR YES YES

What I want to be able to do is to remove all duplicate
soil names eg all JY1, so that only one is listed, but
check the information to the right of it & if it is
different add it next to the one that is kept. I suppose
its like a pivot table, but I want to be able to run a
macro to do this.

help needed. I have written code that can automatically
delete duplicates, but I dont know how to do the rest.

Kind regards

John

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 Angie M. Excel Worksheet Functions 2 February 4th 10 03:55 PM
Deleting Duplicates Jane Excel Discussion (Misc queries) 3 August 17th 07 02:58 AM
duplicates with a twist justche Excel Discussion (Misc queries) 3 September 24th 06 07:09 AM
Deleting Duplicates dcost@sovereignbank Excel Worksheet Functions 5 October 27th 05 02:22 AM
deleting duplicates [email protected] Excel Programming 3 November 13th 03 04:38 PM


All times are GMT +1. The time now is 08:47 PM.

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

About Us

"It's about Microsoft Excel"