Minor error in COUNTIFS

Lanz

New Member
Joined
Jun 9, 2010
Messages
5
I have a question using the COUNTIFS function in excel 2007. I have previously used excel 2003 and created array formulas for my queries, however to standardize a table and make it useful for new datasets (not having to re-describe ranges in columns) the COUNTIFS function proves much more useful by handling this.

My problem is this:
I have a COUNTIFS function that defines multiple criteria, but I cannot get the function to discount cells that are not a certain value represented by a cell.
Example,
This works, where cell D2 is the number 53 and formatted as a number.
=COUNTIFS(sheet1!$range:$range<wbr>,A6,sheet1!$range$range,$C$2,<wbr>sheet1!$range:$range,$D$2)

This does not work, but I want it to:
=COUNTIFS(sheet1!$range:$range<wbr>,A6,sheet1!$range:$range,$C$2,<wbr>sheet1!$range:$range,<>$D$2)

However, replacing the D2 cell with the direct value works, but is not what I want:
=COUNTIFS(sheet1!$range:$range<wbr>,A6,sheet1!$range:$range,$C$2,<wbr>sheet1!$range:$range,"<>53")

I have tried to define the range individually, such as making criteria >d2 and one <d2, but this also did not work. After some time trying this and eventually staring at Excels Ribbon, I am perplexed. If you can help this would be greatly appreciated.<d2, but="" also="" did="" not="" work.="" after="" some="" time="" trying="" other="" uses="" of="" quotes,="" and="" eventually="" staring="" at="" excels="" ribbon,="" i="" am="" perplexed.="" if="" you="" can="" help="" this="" would="" be="" greatly="" appreciated.=""><d2, but="" also="" did="" not="" work.="" after="" some="" time="" trying="" and="" eventually="" staring="" at="" excels="" ribbon,="" i="" am="" perplexed.="" if="" you="" can="" help="" this="" would="" be="" greatly="" appreciated.="">
Thanks</d2,></d2,>
 
Last edited:

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,594
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I have a question using the COUNTIFS function in excel 2007. I have previously used excel 2003 and created array formulas for my queries, however to standardize a table and make it useful for new datasets (not having to re-describe ranges in columns) the COUNTIFS function proves much more useful by handling this.

My problem is this:
I have a COUNTIFS function that defines multiple criteria, but I cannot get the function to discount cells that are not a certain value represented by a cell.
Example,
This works, where cell D2 is the number 53 and formatted as a number.
=COUNTIFS(sheet1!$range:$range<wbr>,A6,sheet1!$range$range,$C$2,<wbr>sheet1!$range:$range,$D$2)

This does not work, but I want it to:
=COUNTIFS(sheet1!$range:$range<wbr>,A6,sheet1!$range:$range,$C$2,<wbr>sheet1!$range:$range,<>$D$2)

However, replacing the D2 cell with the direct value works, but is not what I want:
=COUNTIFS(sheet1!$range:$range<wbr>,A6,sheet1!$range:$range,$C$2,<wbr>sheet1!$range:$range,"<>53")

I have tried to define the range individually, such as making criteria >d2 and one <d2, but="" also="" did="" not="" work.="" after="" some="" time="" trying="" and="" eventually="" staring="" at="" excels="" ribbon,="" i="" am="" perplexed.="" if="" you="" can="" help="" this="" would="" be="" greatly="" appreciated.=""><d2, but="" also="" did="" not="" work.="" after="" some="" time="" trying="" other="" uses="" of="" quotes,="" and="" eventually="" staring="" at="" excels="" ribbon,="" i="" am="" perplexed.="" if="" you="" can="" help="" this="" would="" be="" greatly="" appreciated.=""><d2, but="" also="" did="" not="" work.="" after="" some="" time="" trying="" and="" eventually="" staring="" at="" excels="" ribbon,="" i="" am="" perplexed.="" if="" you="" can="" help="" this="" would="" be="" greatly="" appreciated.="">
Thanks</d2,></d2,>
Try this:
</d2,>
Rich (BB code):
=COUNTIFS(sheet1!$range:$range<wbr>,A6,sheet1!$range:$range,$C$2,<wbr>sheet1!$range:$range,"<>"&$D$2)
<d2, but="" also="" did="" not="" work.="" after="" some="" time="" trying="" and="" eventually="" staring="" at="" excels="" ribbon,="" i="" am="" perplexed.="" if="" you="" can="" help="" this="" would="" be="" greatly="" appreciated.="">
</d2,>
 

Lanz

New Member
Joined
Jun 9, 2010
Messages
5
That did it, it works. Thanks very much, I kind of wish I had asked earlier.
 

Lanz

New Member
Joined
Jun 9, 2010
Messages
5
I only wished I had asked earlier because I know nothing about using the ampersand sign, but will look into this now. Thank you Thank you.
 

Forum statistics

Threads
1,144,567
Messages
5,725,028
Members
422,589
Latest member
JohnnyBravo1

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
Top