Avatar of avgplusguy
avgplusguy
Flag for United States of America asked on

Count whole numbers in column A if the corresponding row in column B is not null

MS EXCEL Office Professional Plus 2016 countif function

Windows 10

I Want to count the number of jobs that are identified as whole numbers in column A

Column A looks like 1, 1.1, 1.2,1.3,1.4, 1.5,1.6,1.7,1.8,2, 2.1,2.2, 3,

The integer rows need to be counted if there is an address in column B

There are other items in column B, but I only wnat to count the project if it has an adress.


This could be done with something similar if I only wanted to count whole #s

and did not have the condition of column B has to be populated on  the row with the whole number


=SUMPRODUCT(--(MOD(A3:A1000,1)=0))


In the example below the answer = 2

In the A column called Line, 1 and 2 would be counted because there is an address in project location, but 3 would not be counted because there is not an address in the project location field 


I inherited this project and am thinking of making the address its own column to simplify and then it could be a simple countif not null scenerio , but I intrigued by the logic to make this work.

 

LineProject Location
1SAMPLE ADDRESS: 123 Federal Ave, Baltimore, MD 21212
1.1Invoice #1
1.2Invoice #2
1.3Invoice #3
1.4Invoice #4
1.5Change Order #1
1.6Change Order #2
1.7JOB TOTALS
2SAMPLE ADDRESS: 45 Baldwin Ave, Baltimore, MD 21212
2.1Invoice #1
2.2
2.3
2.4
2.5Change Order #1
2.6Change Order #2
1.7JOB TOTALS
3
Microsoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Subodh Tiwari (Neeraj)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Subodh Tiwari (Neeraj)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
byundt

=SUMPRODUCT((MOD(A3:A1000,1)=0)*(B3:B1000<>""))

Open in new window

The * is an "And" operator on a row-wise basis in the SUMPRODUCT. By using it, you do not need to use the two minus signs before the first expression.
avgplusguy

ASKER
Thank you gentlemen.
I believe Subodh answered first as it is the first answer after the question.
It has an 11h and Bryundt has 10h so I am guessing this is a time zone issue.
Byundt has a huge knowledge base where I  am still learning and explains items in a way that makes it easy for me to understand.
byundt

There were only 2 minutes between the posts, but Neeraj was definitely first and deserves the points on that basis.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Subodh Tiwari (Neeraj)

You're welcome! Glad we could help.