countifs

nadja

New Member
Joined
Aug 26, 2009
Messages
11
Hi,
I'm trying to create a countif formula that takes into account 3 different criteria:

countif
a) column R equals "delivery" and
b) column S begins with 2 or begins with 8

So far I've come up with this "if" formula, but excel doesn't seem to like the "or" in it:
IF(OR('Adjustments Dec 2011'!S:S="2*",'Adjustments Dec 2011'!S:S="8*"),COUNTIF('Adjustments Dec 2011'!R:R,'Adjustments Dec 2011'!R:R="DELIVERY"))

I hope this makes sense. :confused: Any help is highly appreciated!
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Countif can only do 1 criteria.

You need sumproduct.
Try this

=SUMPRODUCT(--(R1:R1000="Delivery"),--((LEFT(S1:S1000,1)="2")+(LEFT(S1:S1000,1)="8")>0))

I left out the sheet references for simplicity


Important
You can't use Entire Column Refs like S:S in sumproduct
Unless in XL2007 or higher, even then it's not recommended.
 
Upvote 0
Hi,
I'm trying to create a countif formula that takes into account 3 different criteria:

countif
a) column R equals "delivery" and
b) column S begins with 2 or begins with 8

So far I've come up with this "if" formula, but excel doesn't seem to like the "or" in it:
IF(OR('Adjustments Dec 2011'!S:S="2*",'Adjustments Dec 2011'!S:S="8*"),COUNTIF('Adjustments Dec 2011'!R:R,'Adjustments Dec 2011'!R:R="DELIVERY"))

I hope this makes sense. :confused: Any help is highly appreciated!

Is column s all number or combination of text and numbers? what version of excel you have?
 
Upvote 0
Hello nadja, try something like this

=SUMPRODUCT(('Adjustments Dec 2011'!R$2:R$100="Delivery")*(LEFT('Adjustments Dec 2011'!S$2:S$100)={"2","8"}))

adjust ranges as required
 
Upvote 0
Is column s all number or combination of text and numbers? what version of excel you have?


I'm using Excel Professional Plus 2010. The cells in column s are combinations of numbers and text, but they all start with a number.
 
Upvote 0
I've tried both the sumproduct formulas but only get result #n/a.

Has it maybe got to do witht he fact that some of the results in column s are #n/a?

Yes, if there are #N/A errors within the referenced ranges, then the sumproduct will error as well.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

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