PC Review


Reply
Thread Tools Rate Thread

Counting Unique Values That Are Separate by Commas in a Column

 
 
Rothman
Guest
Posts: n/a
 
      25th Mar 2008
I have a column like so, with each text line equalling a cell (the names are
U.S. Counties; 11 cells are below, excerpted from my dataset of around 600
rows):

Mobile, Baldwin
Sumter, Greene, Tuscaloosa, Jefferson, St. Clair, Talladega, Calhoun, Cleburne
Sumter, Greene, Tuscaloosa, Jefferson, St. Clair, Etowah, Dekalb
Mobile, Baldwin, Escambia, Conecuh, Butler, Lowndes, Montgomery, Elmore,
Autauga, Chilton, Shelby, Jefferson, Blount, Cullman, Morgan, Limestone
Montgomery, Macon, Lee, Chambers
Mobile
Tuscaloosa
Jefferson
Limestone, Madison
Etowah

I've used this formula to count all the counties in an individual cell:

=IF(F7<>"",LEN(F7)-LEN(SUBSTITUTE(F7,",",""))+1,0)

However, now I need a state total that counts the counties in the column.
Is there any way of counting only unique values so I don't double count
counties when coming up with my state total?

Thanks again!
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      25th Mar 2008
Assuming G1 contains the name of the county you want to search for and
Column F contains your listing, try this formula...

=SUMPRODUCT(--ISNUMBER(SEARCH(G1,F1:F1000)))

Rick


"Rothman" <(E-Mail Removed)> wrote in message
news:18C3FB1B-EBDE-412A-9C29-(E-Mail Removed)...
>I have a column like so, with each text line equalling a cell (the names
>are
> U.S. Counties; 11 cells are below, excerpted from my dataset of around 600
> rows):
>
> Mobile, Baldwin
> Sumter, Greene, Tuscaloosa, Jefferson, St. Clair, Talladega, Calhoun,
> Cleburne
> Sumter, Greene, Tuscaloosa, Jefferson, St. Clair, Etowah, Dekalb
> Mobile, Baldwin, Escambia, Conecuh, Butler, Lowndes, Montgomery, Elmore,
> Autauga, Chilton, Shelby, Jefferson, Blount, Cullman, Morgan, Limestone
> Montgomery, Macon, Lee, Chambers
> Mobile
> Tuscaloosa
> Jefferson
> Limestone, Madison
> Etowah
>
> I've used this formula to count all the counties in an individual cell:
>
> =IF(F7<>"",LEN(F7)-LEN(SUBSTITUTE(F7,",",""))+1,0)
>
> However, now I need a state total that counts the counties in the column.
> Is there any way of counting only unique values so I don't double count
> counties when coming up with my state total?
>
> Thanks again!


 
Reply With Quote
 
Rothman
Guest
Posts: n/a
 
      25th Mar 2008
I'm sorry, but it seems once again my powers of explanation have proven to be
inadequate.

I don't have a listing of counties that I'm comparing my column against.
All I'm looking for is a number that represents "number of counties covered"
for a particular state. Given my column, which has cells which contain more
than one county, and that the same county may appear in two or more different
cells, I just need to count the unique counties in the column (as opposed to
summing up the formula I used to count the counties per cell, which double
counts).



"Rick Rothstein (MVP - VB)" wrote:

> Assuming G1 contains the name of the county you want to search for and
> Column F contains your listing, try this formula...
>
> =SUMPRODUCT(--ISNUMBER(SEARCH(G1,F1:F1000)))
>
> Rick
>
>
> "Rothman" <(E-Mail Removed)> wrote in message
> news:18C3FB1B-EBDE-412A-9C29-(E-Mail Removed)...
> >I have a column like so, with each text line equalling a cell (the names
> >are
> > U.S. Counties; 11 cells are below, excerpted from my dataset of around 600
> > rows):
> >
> > Mobile, Baldwin
> > Sumter, Greene, Tuscaloosa, Jefferson, St. Clair, Talladega, Calhoun,
> > Cleburne
> > Sumter, Greene, Tuscaloosa, Jefferson, St. Clair, Etowah, Dekalb
> > Mobile, Baldwin, Escambia, Conecuh, Butler, Lowndes, Montgomery, Elmore,
> > Autauga, Chilton, Shelby, Jefferson, Blount, Cullman, Morgan, Limestone
> > Montgomery, Macon, Lee, Chambers
> > Mobile
> > Tuscaloosa
> > Jefferson
> > Limestone, Madison
> > Etowah
> >
> > I've used this formula to count all the counties in an individual cell:
> >
> > =IF(F7<>"",LEN(F7)-LEN(SUBSTITUTE(F7,",",""))+1,0)
> >
> > However, now I need a state total that counts the counties in the column.
> > Is there any way of counting only unique values so I don't double count
> > counties when coming up with my state total?
> >
> > Thanks again!

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting unique values in column WildWill Microsoft Excel Misc 3 19th Apr 2009 05:53 PM
Excel Pivot Table - Counting Unique Values within one column of da GBONDI Microsoft Excel Worksheet Functions 1 22nd Jan 2009 01:26 PM
Counting unique entries in column A but only if specific values appear in columns B and C markx Microsoft Excel Worksheet Functions 2 10th Feb 2005 01:08 PM
Counting 2 Separate Columns With Unique Data JAYDE Microsoft Excel Programming 1 10th Sep 2003 02:08 PM
Counting Unique Values in A column ibeetb Microsoft Excel Programming 2 25th Jul 2003 04:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:17 PM.