Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: sum unique/total items on one sheet and put values on anothe

  1. #1
    New Member
    Join Date
    Apr 2002
    KC, MO
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)


    I've got a lot of data on a particular spread sheet (lots of them actually) and am interested in calculating some basic stats on it. I would like to have a formula or macro examine each sheet and tell me the number of total items (lines of data - 1 for the heading) and the number of total UNIQUE items for a particular column.

    I'm not sure if this is further complicated by the fact that there are 500-1000+ lines that are empty. To eliminate the headers/footers from the external report, I ran a FOR/NEXT loop to ClearContents of a row if a cell's criteria matched certain things. I thought about deleting the row, but that would make my FOR/NEXT loop skip every other row when one was deleted (& renumbered). I'm thinking about redoing my routine to axe those header/footer lines, but haven't given it much thought yet.

    One possible (albeit ugly) solution would be to take Mr.Excel's Table of Contents example and just extrapolate it to get those values for both unique/non-unique pages then do the math to calculate how many lines per page to get a rough estimate.

    Another solution I've thought of, again pretty ugly, would be to step through each cell of a column, set the string value to the new cell value and compare to the old string value, if different then sum, if same them next row... something like that...

    Your suggestion on this would be greatly appreciated.

  2. #2
    MrExcel MVP Aladin Akyurek's Avatar
    Join Date
    Feb 2002
    The Hague, NL
    Post Thanks / Like
    43 Post(s)
    8 Thread(s)


    Suppose we have the following columns of data in columns A and B with labels in row 1 in Sheet1:


    where "" stands for blank cells.
    Notice that column A is of numeric type and B of alphanumeric type.

    In a sheet called e.g., Overview,

    In A2 enter:


    This gives you the size of the used range in column A of Sheet1.

    In A3 enter:


    This gives you a count of numeric data (including real 0's) in column A of Sheet1.

    In A4 enter:


    This gives you a count of unique numbers in column A of Sheet1.

    In B2 enter:


    This gives you the size of the used range in column B of Sheet1.

    In B3 enter:

    =COUNTA(OFFSET(Sheet1!B2,0,0,B2-1,1)) or


    This gives you a count of alphanumeric/textual data (including formula-generated blanks if any exists) in column B of Sheet1.

    In B4 array-enter:


    This gives you a count of unique alphanumeric/textual entries (exluding formula-generated blanks if they exist) in column B of Sheet1.

    Note 1. In order to array-enter a formula, you need to hit control+shift+enter, not just enter.

    Note 2. If a target column is of mixed data type, use the second set of formula in such cases.


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts