JimmieNeu

New Member
Joined
Oct 22, 2018
Messages
28
Office Version
  1. 365
Platform
  1. Windows
This is the formula I am trying to use:

=COUNTIFS(A5,"PQ",C4:C8,"Actual Straight")

It is not working, I am getting a "#VALUE!" error.


If I expand A5 into a range of cells (A4:A8), it sort-of works. I say sort-of because I think it really isn't including the range of cells. If "PQ" is in cell A5 for example, the formula returns a 0. I was hoping it would return a 1. It will only return a 1 if "PQ" is in cell A4 and "Actual Straight" is in cell C4.


My goal:
If cell A5 = "PQ" and any cell in range C4:C8 = "Actual Straight", I want the formula to return a "1".
If the above condition is not met, I want formula to return a blank cell.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
MAybe this instead....
Code:
=SUMPRODUCT(--(C4:C8="Actual Straight")*(A5="PQ"))
 
Upvote 0
That worked!!

I changed it to this to get rid of the "0" return.

Code:
=IF(SUMPRODUCT(--(C4:C8="Actual Straight")*(A5="PQ"))=0,"",(SUMPRODUCT(--(C4:C8="Actual Straight")*(A5="PQ"))))
 
Last edited:
Upvote 0
you could also simply change the format of the cell to a Custom format and use my original posted formula

Code:
[=0]"";General
 
Last edited:
Upvote 0
Try

=IF(AND(A5="PQ",COUNTIF(C4:C8,"Actual Straight")),1,"")


That works as well!
THANK YOU!


How would I add "Fish Bench" to the formula?
"PQ" in cell A5, if either "Fish Bench" or "Actual Straight" are in cells C4:C8, the formula would return a 1 or a blank cell.
 
Upvote 0
You are welcome.

Here is an updated formula for you to try:

=IF(AND(A5="PQ",SUM(COUNTIF(C4:C8,{"Actual Straight","Fish Bench"}))),1,"")
 
Upvote 0
You are welcome.

Here is an updated formula for you to try:

=IF(AND(A5="PQ",SUM(COUNTIF(C4:C8,{"Actual Straight","Fish Bench"}))),1,"")

Awesome!!

I was trying this:
Code:
=IF(AND(A5="PQ",COUNTIF(C4:C8,{"Actual Straight";"Fish Bench:})),1,"")
 
Upvote 0

Forum statistics

Threads
1,215,494
Messages
6,125,137
Members
449,207
Latest member
VictorSiwiide

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