Sorting emails by domains, from org to edu (right char is the most significant)

  • Thread starter Thread starter duzhidian
  • Start date Start date
D

duzhidian

Hello All
I need to sort the domains according their emails.

For example:

Before sorting:
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)

After sorting:
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)

That is, how to sort, according to the domain name ( the right is the
most significant )?

Thanks.


Z. D.
 
That is, how to sort, according to the domain name ( the right is the
most significant )?

you'll probably need to create some helper columns. use text parsing
functions like SEARCH, LEFT, MID, RIGHT to separate the different
fields you need. then do a multiple sort.
 
Insert an empty column to the right of your data
Select your column
Data|Text to columns
delimited by other (@)
and skip the first field

Then sort your range using that adjacent column as the primary key. And the
original column as the secondary key.
 
I didn't notice that portion.

I'd still use the data|text to columns, but then I'd use another column with
something like:

=if(right(b1,4)=".org",1,if(right(b1,4)=".com",2,if(right(b1,4)=".edu",3,4)))

And then use that numeric column as the primary key, the domain column for the
secondary key and the original column as the tertiary key.
 
Insert an empty column to the right of your data
Select your column
Data|Text to columns
delimited by other (@)
and skip the first field

Then sort your range using that adjacent column as the primary key. And the
original column as the secondary key.

... and if you want the org/com/edu sort order, you'll probably need a
custom list as well.
 
I didn't notice that portion.

I'd still use the data|text to columns, but then I'd use another column with
something like:

=if(right(b1,4)=".org",1,if(right(b1,4)=".com",2,if(right(b1,4)=".edu",3,4)))

And then use that numeric column as the primary key, the domain column for the
secondary key and the original column as the tertiary key.

Code the helper column ... yep ... that will work ... and is probably a
better long term solution. Custom lists can be a pain, popping up when they
are least expected :)

Thanks

 
Hello All
I need to sort the domains according their emails.

For example:

Before sorting:
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)

After sorting:
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
(e-mail address removed)

That is, how to sort, according to the domain name ( the right is the
most significant )?

Thanks.


Z. D.

If you want to do this using a formula approach, you could download and install
Longre's free morefunc.xll add-in from http://xcell05.free.fr/

Then use this **array** formula (enter the formula by holding down
<ctrl><shift> while hitting <enter>. Excel will place braces {...} around the
formula).

=INDEX(VSORT(rng,MID(rng,FIND(".",rng,FIND("@",rng))
+1,255),1,MID(rng,FIND("@",rng)+1,-1+FIND(".",rng,
FIND("@",rng))-FIND("@",rng)),1),ROWS($1:1))

Copy/drag down as far as necessary.
--ron
 
If you want to do this using a formula approach, you could download and install
Longre's free morefunc.xll add-in from http://xcell05.free.fr/

Then use this **array** formula (enter the formula by holding down
<ctrl><shift> while hitting <enter>. Excel will place braces {...} around the
formula).

=INDEX(VSORT(rng,MID(rng,FIND(".",rng,FIND("@",rng))
+1,255),1,MID(rng,FIND("@",rng)+1,-1+FIND(".",rng,
FIND("@",rng))-FIND("@",rng)),1),ROWS($1:1))

Copy/drag down as far as necessary.
--ron


Oh, dummy me. Since you'd be downloading morefunc anyway, the following is
more efficient and does NOT need to be entered as an array formula:

=INDEX(VSORT(rng,REGEX.MID(rng,"[^\.]+$"),1,REGEX.MID(rng,"@[^\.]+",1)),ROWS($1:1))

--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top