Be Excellent To Each Other

And, you know, party on. Dude.

All times are UTC [ DST ]




Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:00 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69509
Location: Your Mum
I've got a big long list of alpha-num IDs.
I need to get rid of any IDs that are duplicated, and I don't mean just get rid of the extras, but the originals too.

So if my list was
Code:
a1
b1
b1
b1
c2
c3
c3
c4

I need to end up with
Code:
a1
c2
c4


Can you beat my Google search?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:03 
User avatar

Joined: 31st Mar, 2008
Posts: 925
PivotTable!

Create a PivotTable that counts the number of times each item occurs. If it is 1 then you can delete it off the list.

PivotTables are fun. Everyone should learn to use PivotTables.


Top
 Profile  
 
 Post subject: Re: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:04 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69509
Location: Your Mum
Bluecup wrote:
Create a pivottable that counts the number of times each items occurs. If it is 1 then you can delete it off the list.

If it is not 1, surely?
Also: What? Bear in mind that I don't use Excel. Ever.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:08 
User avatar
Sleepyhead

Joined: 30th Mar, 2008
Posts: 27343
Location: Kidbrooke
Pivot Table is the way to go.

Though I get confused easily by Pivot Tables and would write a ridiculously complicated and inefficient macro to do it instead.

_________________
We are young despite the years
We are concern
We are hope, despite the times


Top
 Profile  
 
 Post subject: Re: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:09 
User avatar
Isn't that lovely?

Joined: 30th Mar, 2008
Posts: 10938
Location: Devon
use the pivot table or do a countif in the next column along

ie make B2 =COUNTIF(A:A,A2)
make B3 =COUNTIF(A:A,A3)

and so on

and then filter or the c column to only display "1"

Malc

_________________
Where's the Kaboom? I was expecting an Earth shattering Kaboom!


Top
 Profile  
 
 Post subject: Re: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:10 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69509
Location: Your Mum
Yes, countif is the way I did it (I didn't use a pivot table, though).

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:11 
User avatar

Joined: 31st Mar, 2008
Posts: 925
Grim... wrote:
Bluecup wrote:
Create a pivottable that counts the number of times each items occurs. If it is 1 then you can delete it off the list.

If it is not 1, surely?
Also: What? Bear in mind that I don't use Excel. Ever.


Oh yeah, misread it a little.

*Select the column of ids (make sure it has a header at the top)
*From the menus select data>Pivottable and pivotchart report
*Go next, next, finish
*The next bit is a bit hard to explain. There should be a floating box in front of you with the column header in and on the main sheet itself a white box split into 4. Drag the column header into the two biggest boxes.
*It should now be a nice table with a count which you can copy and past and sort how you want.


Top
 Profile  
 
 Post subject: Re: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:13 
User avatar

Joined: 31st Mar, 2008
Posts: 8648
Assuming your list is in column A, and starts in A2 (because there's a heading in A1), then type the following in B2 (or your next free column)

=countif(A:A, A2)

Drag that formula all the way down that column (highlight cell B2 and then double-click on the little square in the bottom right of the cell).

That should give you a count of how many times the corresponding cell appears in the list, so filter column B for everything greater than 1 (data > Filter > autofilter, click the dropdown on column B and choose custom, then greater than 1).

Then highlight all the rows you can still see and delete them.

Edit - although I've been beaten, my way gets rid of the duplicates, rather than just filtering for everything else. A pivot table would work for that as well, it just kind of depends whether you want to change your original data, or copy/paste elsewhere.

Edit again - Oh, I see you've done it now. I'll just shut up then. :(


Top
 Profile  
 
 Post subject: Re: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:22 
User avatar
Isn't that lovely?

Joined: 30th Mar, 2008
Posts: 10938
Location: Devon
Joans wrote:
Assuming your list is in column A, and starts in A2 (because there's a heading in A1), then type the following in B2 (or your next free column)

=countif(A:A, A2)

Drag that formula all the way down that column (highlight cell B2 and then double-click on the little square in the bottom right of the cell).

That should give you a count of how many times the corresponding cell appears in the list, so filter column B for everything greater than 1 (data > Filter > autofilter, click the dropdown on column B and choose custom, then greater than 1).

Then highlight all the rows you can still see and delete them.

Edit - although I've been beaten, my way gets rid of the duplicates, rather than just filtering for everything else. A pivot table would work for that as well, it just kind of depends whether you want to change your original data, or copy/paste elsewhere.

Edit again - Oh, I see you've done it now. I'll just shut up then. :(



I was implying copying the cells you could see to elsewhere. I assumed Grim... was clever enough to work that bit out for himself.

Malc

_________________
Where's the Kaboom? I was expecting an Earth shattering Kaboom!


Top
 Profile  
 
 Post subject: Re: Excel Champions!
PostPosted: Wed Apr 30, 2008 17:23 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69509
Location: Your Mum
You've all been very helpful, but I have done it now, yes. I copied the whole list into anther sheet and did
Code:
=IF(COUNTIF(Sheet2!A:A,Sheet1!A1)=0,"No","Yes")

Then I deleted all the 'yes' ones.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: MaliA, markg and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search within this thread:
You are using the 'Ted' forum. Bill doesn't really exist any more. Bogus!
Want to help out with the hosting / advertising costs? That's very nice of you.
Are you on a mobile phone? Try http://beex.co.uk/m/
RIP, Owen. RIP, MrC.

Powered by a very Grim... version of phpBB © 2000, 2002, 2005, 2007 phpBB Group.