+ Reply to Thread
Results 1 to 13 of 13

Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

  1. #1
    Registered User
    Join Date
    07-04-2017
    Location
    Norway
    MS-Off Ver
    Office 365 2016
    Posts
    6

    Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    Hello,

    I currently have a guest list made in Excel. Column B is "Invitee" and Column C is "Guest". The priority of these guests is in Column D. The priority has a value of 1, 2 or 3.

    I am looking to make a function to count the number of guests that are priority 1, or 2 or 3. The only hang-up I'm having is that some of the Invitees have blank cells in the guest column, so I can't just use =COUNTIF(Table4[Priority];1) * 2

    I have tried using IF, CountIF and CountA but I can't seem to use them properly in conjunction to show totals. Is anyone able to offer some advice?

    Thank you in advance!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    What version of Excel do you have? Is it post 2007? (Update your profile so that we will know in the future)

    If so use COUNTIFS()

    Upload the workbook if you're still struggling.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-04-2017
    Location
    Norway
    MS-Off Ver
    Office 365 2016
    Posts
    6

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    Hi,

    I have tried using COUNTIFS(), but it has returned #VALUE!. I tried =COUNTIFS(Table4[Priority];1; Table4[[Invitee]:[Guest]]; "<>")

    I have uploaded a screenshot of what I am hoping to do...
    I would like the TOTAL P1 to give the number of guests (dates included) with priority 1, P2 to give guests with priority 2 and so on.


    Excel Q.PNG

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    attach a sample excel file with expected result
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Registered User
    Join Date
    07-04-2017
    Location
    Norway
    MS-Off Ver
    Office 365 2016
    Posts
    6

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    Hello,

    I have attached the sample excel file, showing the values I am hoping to get for TOTAL P1, TOTAL P2 and TOTAL P3.

    Thanks for your time.
    Attached Files Attached Files

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    there is only 18 rows with data Then how Total P1: = 25

  7. #7
    Registered User
    Join Date
    07-04-2017
    Location
    Norway
    MS-Off Ver
    Office 365 2016
    Posts
    6

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    I would like it to add up the total of non-blank spaces from Invitee + Guest columns. Most invitees will also have a guest, but not all. I am trying to show how many total people to account for that are P1, P2 and P3, including their guests.
    Sorry if this is confusing. It is a wedding guest list, if that helps with the concept.

  8. #8
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    In "H3"
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Same will apply "J3" & "L3" needs to change only highlighted number as "2" / "3"


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    Assuming you don't want to count where there are no guests then in H3

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    copy to H3, L3 changing the 1 to 2 & 3

  10. #10
    Registered User
    Join Date
    07-04-2017
    Location
    Norway
    MS-Off Ver
    Office 365 2016
    Posts
    6

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    Hi,
    Thanks for the reply.

    This is getting close to what I am looking for, except I want to count the number of total guests from both column B AND column C.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    but when I try to change to both B and C columns, I get a VALUE! error.

  11. #11
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    H3=countifs(b4:b21,"?*",d4:d21,1)+countifs(c4:c21,"?*",d4:d21,1)
    j3=countifs(b4:b21,"?*",d4:d21,2)+countifs(c4:c21,"?*",d4:d21,2)
    l3==countifs(b4:b21,"?*",d4:d21,3)+countifs(c4:c21,"?*",d4:d21,3)

  12. #12
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    ...maybe

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    07-04-2017
    Location
    Norway
    MS-Off Ver
    Office 365 2016
    Posts
    6

    Re: Count number of nonblank cells in column B, C if value in column D = 1 (or 2)

    Thanks Richard!
    I don't know why I didn't think to add two CountIFS together ... D'oh!

+ 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. need to count a specific number of nonblank cells that match a certain critera
    By JCHRISTMAS1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-02-2015, 11:59 AM
  2. Replies: 4
    Last Post: 04-25-2013, 03:53 AM
  3. [SOLVED] How to count the number of nonblank cells which have values
    By BNCOXUK in forum Excel General
    Replies: 2
    Last Post: 10-31-2012, 07:36 PM
  4. Replies: 9
    Last Post: 06-08-2012, 06:22 PM
  5. Replies: 10
    Last Post: 07-21-2011, 07:23 AM
  6. formula to count nonblank cells in a column
    By 2funny4words in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-13-2010, 06:31 PM
  7. [SOLVED] count the number of nonblank cells within a range
    By Hervinder in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2006, 10:40 AM

Tags for this Thread

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