+ Reply to Thread
Results 1 to 4 of 4

Count number of non-empty columns in a multi-row range

  1. #1
    Registered User
    Join Date
    03-13-2014
    Location
    London
    MS-Off Ver
    Excel for Mac 2011
    Posts
    3

    Count number of non-empty columns in a multi-row range

    Hello,

    I need a formula to count the number of columns that contain text, within a multi row range.

    So in the attached example:
    - For each row, insert a formula in Column N that calculates:
    - Looking at all other rows that have the same ID as this row in Column M
    - Count the number of columns between Column A and Column L inclusive that are not empty

    So in the first row of the example, which has the ID 'CN_011' in Column M, there are 5 rows in total that also have that value. Looking at these 5 rows, there are 5 instances of columns (between Column C and Column N) that are not empty. So the answer I need is '5'.

    Hoping someone out there can help!

    Many thanks in advance
    Amanda
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Count number of non-empty columns in a multi-row range

    I think:
    =SUM(IF(FREQUENCY(IF(M$2:M$11=M2,1,0)*IF(A$2:L$11<>"",COLUMN(A1:L1),0),COLUMN(A1:L1))<>0,1,0))+1
    in N2 as an array formula (confirm with ctrl+shift+enter) and then copied down as neccessary would work.

  3. #3
    Registered User
    Join Date
    03-13-2014
    Location
    London
    MS-Off Ver
    Excel for Mac 2011
    Posts
    3

    Re: Count number of non-empty columns in a multi-row range

    Hey ragulduy, thanks for your reply!

    I copied and pasted your formula in but it seems to be giving me the wrong answer - it's giving me a result of 7 where it should be 5, and 3 where it should be 1. In fact, putting the formula into my main spreadsheet with the full dataset, the value given seems to be consistently over by 2. Shall I just put a '- 2' into the formula? Or have you any ideas for fixing the formula?

    thanks lots
    Amanda

  4. #4
    Registered User
    Join Date
    03-13-2014
    Location
    London
    MS-Off Ver
    Excel for Mac 2011
    Posts
    3

    Re: Count number of non-empty columns in a multi-row range

    Sorry I just realised that all I needed to do is change the +1 at the very end of your formula to -1, and it works perfectly!

    So the formula is:
    =SUM(IF(FREQUENCY(IF(M$2:M$11=M2,1,0)*IF(A$2:L$11<>"",COLUMN(A1:L1),0),COLUMN(A1:L1))<>0,1,0))-1

    Thanks so much ragulduy!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 07-28-2013, 10:24 AM
  2. Count it multi criteria accross multi cells
    By jfoley5197 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-10-2013, 03:42 PM
  3. Count the number of cells in a range that are not empty
    By efernandes67 in forum Excel General
    Replies: 5
    Last Post: 07-23-2010, 05:41 AM
  4. [SOLVED] Finding next empty empty cell in a range of columns
    By UncleBun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2006, 07:25 PM
  5. [SOLVED] To find number of non-empty cells across columns
    By Mark Stephens in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2005, 10:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1