COUNT IF

BeckaB

New Member
Joined
Apr 4, 2019
Messages
11
I have a sheet with data in for months, i have done 1 count if statement to count the number of cars sold in 1 month based on the month being filtered on another cell.

What i want to do is add another part to the formula to say "Count if the number of cars sold in column X when the month is X but then another bit to say "IF "ALL" is selected return the count for the full year rather than just 1 months data

Is this possible?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Maybe something like this?

Book1
ABCDE
1MonthCarMonthCount
2JanHondaAll12
3FebFord
4FebAcura
5JanLexus
6JanJaguar
7FebChevy
8FebExpedition
9FebHyundai
10FebMaserati
11JanMini Cooper
12JanToyota
13JanSubaru
14
Sheet11
Cell Formulas
RangeFormula
E2E2=COUNTIF(A2:A13,IF(D2="All","*",D2))
 
Upvote 0
Hi,

That doesn't work, I've done a count ifs:

=COUNTIFS('Commission Data - Bookings'!F:F,Build!B7,'Commission Data - Bookings'!P:P,Build!C1,'Commission Data - Bookings'!Q:Q,Build!C2,'Commission Data - Bookings'!R:R,Build!C3)

The month on the data tab is column Q and the month dropdown where I have Jan-Dec and then All is cell C2 on the build tab
 
Upvote 0
Have written both formulas so the code works, just need to combine into one


=IF($C$2="All",COUNTIFS('Commission Data - Bookings'!F:F,Build!B7,'Commission Data - Bookings'!P:P,Build!$C$1,'Commission Data - Bookings'!R:R,Build!$C$3),COUNTIFS('Commission Data - Bookings'!F:F,Build!B7,'Commission Data - Bookings'!P:P,Build!$C$1,'Commission Data - Bookings'!Q:Q,Build!$C$2,'Commission Data - Bookings'!R:R,Build!$C$3))

=IF($C$1="All",COUNTIFS('Commission Data - Bookings'!F:F,Build!B7, 'Commission Data - Bookings'!Q:Q,Build!$C$2,'Commission Data - Bookings'!R:R,Build!$C$3),COUNTIFS('Commission Data - Bookings'!F:F,Build!B7,'Commission Data - Bookings'!P:P,Build!$C$1,'Commission Data - Bookings'!Q:Q,Build!$C$2,'Commission Data - Bookings'!R:R,Build!$C$3))


how do I combine?
 
Upvote 0
You can use the technique I showed in post 2 to shorten both of those formulas like this:

=COUNTIFS('Commission Data - Bookings'!F:F,Build!B7,'Commission Data - Bookings'!P:P,Build!$C$1,'Commission Data - Bookings'!Q:Q,IF($C2="All","*",Build!$C$2),'Commission Data - Bookings'!R:R,Build!$C$3)

=COUNTIFS('Commission Data - Bookings'!F:F,Build!B7,'Commission Data - Bookings'!P:P,IF($C$1="All","*",Build!$C$1),'Commission Data - Bookings'!Q:Q,Build!$C$2,'Commission Data - Bookings'!R:R,Build!$C$3)

And when you say you want to combine them, I'm not entirely clear what you want, but using that same technique, I think it would be something like this:

=COUNTIFS('Commission Data - Bookings'!F:F,Build!B7,'Commission Data - Bookings'!P:P,IF($C$1="All","*",Build!$C$1),'Commission Data - Bookings'!Q:Q,IF($C2="All","*",Build!$C$2),'Commission Data - Bookings'!R:R,Build!$C$3)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

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