Formula Required to count values over a range

Arts

Well-known Member
Joined
Sep 28, 2007
Messages
765
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi guys

I can't seem to think of what formula (combination) is required for the below.

I need to count the number of times that the below has a value in both cells, so for the below this should give me the value of 3 as this is the number of times Subject and Description have a value (entry).

I cant seem to think of what formula to use. I have no issue doing this over one row =COUNT(AND(ISTEXT(A2),ISTEXT(B2))) but am stuck when needing to do this over a range. I did try =COUNTA(AND(ISTEXT(A2:A6),ISTEXT(B2:B6))) but this doesn't seem to give me the outcome needed.


1666183540471.png


As always thank you for any assistance.

Arts
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try this:
Excel Formula:
=COUNTIFS(A2:A6,"<>",B2:B6,"<>")
 
Upvote 0
Solution
Try this:
Excel Formula:
=COUNTIFS(A2:A6,"<>",B2:B6,"<>")
It always makes me laugh when you get the response and it's looks so simple there was me messing around with ISTEXT, AND, COUNTA and you provide the above using one function!! 😂

Thank you so much Joe4

Arts
 
Upvote 0
Yeah, I think we have all had that experience, at one time or another. ;)

You are welcome. Glad I was able to help!
 
Upvote 0
Yeah, I think we have all had that experience, at one time or another. ;)

You are welcome. Glad I was able to help!

As per usual if I could ask a follow up for learning purposes. The <> means does not equal but in this case you have simply put it around quotations? Usually it's followed up with something ie what is it we do not want it to equal too i.e <> ""
 
Last edited:
Upvote 0
As per usual if I could ask a follow up for learning purposes. The <> means does not equal but in this case you have simply put it around quotations? Usually it's followed up with something ie what is it we do not want it to equal too <> ""
Sure, no problem.
When you write it like that, it is sort of a shortcut way of writing "not equal to nothing" (meaning, it is actually "equal to something").
 
Upvote 0
Sure, no problem.
When you write it like that, it is sort of a shortcut way of writing "not equal to nothing" (meaning, it is actually "equal to something").

Ah I see I'm stuck in the dark ages I would normally write it as such within a formula =IF(A5<>"","Result","Entry needed")
 
Upvote 0
Ah I see I'm stuck in the dark ages I would normally write it as such within a formula =IF(A5<>"","Result","Entry needed")
The difference in that is in the COUNTIFS, the <> is already between double-quotes, whereas in your IF statement, it is not.
So to try to put something that already contains double-quotes, like <>"", inside of double-quotes gets a little messy.
Luckily, we don't need to in this case.
 
Upvote 0
The difference in that is in the COUNTIFS, the <> is already between double-quotes, whereas in your IF statement, it is not.
So to try to put something that already contains double-quotes, like <>"", inside of double-quotes gets a little messy.
Luckily, we don't need to in this case.

Oh ok I get it now in that the criteria aspect of the COUNTIFS requires it to be in "" so the <> doesn't need the double quotes.

It does cross my mind in that who is it that taught guys like you (by that I mean individuals that seem to know it all!) all of this, did you just pick up a book and it stuck? Really is quite incredible,

Anyway I'm sure there are other people that need your help with actual excel queries rather than non excel queries I'm now starting to dive into.

Thank you once again for all of your help!!

Arts
 
Upvote 0
You are welcome.

I had picked up a few books (especially VBA early in my career), but a lot of what I picked up is from this site, just by reading posts that interest me and seeing how others handle it.
 
Upvote 0

Forum statistics

Threads
1,214,869
Messages
6,122,015
Members
449,060
Latest member
LinusJE

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