Countif using totals of two named columns

PatRichard

New Member
Joined
Dec 29, 2018
Messages
28
Office Version
  1. 365
Platform
  1. Windows
I'm trying to use countif to figure out how many rows have two cells that added together are greater than another value. I know for a single column, something like
Excel Formula:
=COUNTIF(SiteInfo[Number of Users],"<"&Data!E51)
works fine. But I want the sum of SiteInfo[Number of Users] + SiteInfo[Shared Devices] as the criteria, and just can't seem to find something that works. The closest I've come is counting the number of rows where either cell is < Data!E51. Thoughts?

1719980730506.png
 
Are the rows truly empty or are they empty strings "" e.g. returned from a formula?
They are empty. They have some data validation criteria and some input messages to describe what I'm looking for.

1719985619832.png
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try this:
Excel Formula:
=SUM(--(TOCOL(SiteInfo[Number of Users],1) + TOCOL(SiteInfo[Shared Devices],1)<Data!E51))
 
Upvote 0
Try this:
Excel Formula:
=SUM(--(TOCOL(SiteInfo[Number of Users],1) + TOCOL(SiteInfo[Shared Devices],1)<Data!E51))
Ah - that seems to work. I'll have to read up on TOCOL and the double hyphen a bit to understand it. Thanks!
 
Upvote 0
The TOCOL and 1 remove the empty cells. The -- coerces the booleans into numbers 0's and 1's. On second thought, this method is not foolproof. Would you ever have a situation when one cell is empty like this (see row 8 and 9)?
Book1
BCD
1Number of UsersShared Devices
242
365
418831
500
61327
709
80< Empty
94< Empty
1020
1103
1207
13012
1422
1544
1601
1756
1852
1950
2010439
21183
22397
2300
Sheet2
 
Upvote 0
The TOCOL and 1 remove the empty cells. The -- coerces the booleans into numbers 0's and 1's. On second thought, this method is not foolproof. Would you ever have a situation when one cell is empty like this (see row 8 and 9)?
Book1
BCD
1Number of UsersShared Devices
242
365
418831
500
61327
709
80< Empty
94< Empty
1020
1103
1207
13012
1422
1544
1601
1756
1852
1950
2010439
21183
22397
2300
Sheet2
Ideally, no. But customers fill this out and send it back to me for review. So I would question the empty cells and adjust as needed.
 
Upvote 0
What constitutes an empty row. Is there a specific column that if empty means the row is empty ?
The below is Cubist formula which considers the row empty if BOTH the value columns are empty.

Excel Formula:
=SUM((SiteInfo[Number of Users]+SiteInfo[Shared Devices]<Data!E51)*((SiteInfo[Number of Users]&SiteInfo[Shared Devices])<>""))
 
Upvote 0
What constitutes an empty row. Is there a specific column that if empty means the row is empty ?
The below is Cubist formula which considers the row empty if BOTH the value columns are empty.

Excel Formula:
=SUM((SiteInfo[Number of Users]+SiteInfo[Shared Devices]<Data!E51)*((SiteInfo[Number of Users]&SiteInfo[Shared Devices])<>""))
I'll play with that. We tell the customer that no cells in the workbook should be empty for any site (row) containing data.
 
Upvote 0
I'll play with that. We tell the customer that no cells in the workbook should be empty for any site (row) containing data.
Alex's formula accounts for the situation mentioned in post#14 when 1 cell is empty. It would count those rows as FALSE.
 
Upvote 0
Alex's formula accounts for the situation mentioned in post#14 when 1 cell is empty. It would count those rows as FALSE.
Not sure if I am misinterpreting what you are saying but that formula will count it if either of the value columns are not blank.

@PatRichard if you want us to ignore the row if either of the rows are blank just let us know but then you might want another count formula to flag that you have some that are only partially complete.
 
Upvote 0
Not sure if I am misinterpreting what you are saying but that formula will count it if either of the value columns are not blank.

@PatRichard if you want us to ignore the row if either of the rows are blank just let us know but then you might want another count formula to flag that you have some that are only partially complete.
This should be sufficient. I use some other methods to flag empty cells, etc. I appreciate everyone's help.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top