How to Limit my countifs based on rows

Ritche

New Member
Joined
May 7, 2019
Messages
6
Hi Everyone, I been banging my head over 2 days trying to figure out how to forecast the amount of sensors.

The data I have has column B (Locations) But this location doubles up based on the different branch it has. So some location can have up to 10 entries. from C to AC are dates that each locations's branch needs more unit.

Since I have to send it to the Main location, how do I limit my countifs to just that location automatically?

I calculated the overall how much I need to send out per month using.

=COUNTIFS(Sheet4!$C:$AC,">4/1/2019", Sheet4!$C:$AC,"<4/30/2019") <-- this is an example of April.

How do I limit the count per location. Location are example ( 201,202,203,204, etc..) Do I need to add vlook up? Location are all over the cell and i would have to add it so I can't limit the range.

Also since I only need the month information is there a way to conver the 4/10/2019 to just say april 2019 and reads as April 2019? I had to do the date range because when i format the date to Apr 2019 it still has the actually date on it.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I tried using this =COUNTIFS(Sheet4!A:A,Sheet3!A5,Sheet4!$C:$AC,">="&B1, Sheet4!$C:$AC,"<="&B2) but it return #value

A= 201, B3= 4/1/2019, B2=4/30/2019
 
Upvote 0
Maybe this...

=COUNTIFS(INDEX(Sheet4!C:AC,MATCH(Sheet3!A5,Sheet4!A:A,0),0),">="&B1,INDEX(Sheet4!C:AC,MATCH(Sheet3!A5,Sheet4!A:A,0),0),"<="&B2)

M.
 
Upvote 0
Hi Marcelo, It did not count all the 201 that has April date in it. There is 16 entry of 201 and their is around 18 total April entry within all of the 201
 
Upvote 0
Hi Marcelo, It did not count all the 201 that has April date in it. There is 16 entry of 201 and their is around 18 total April entry within all of the 201

Ah, now i fully understand what you need

Assumed data in rows 1 to 100 (adjust to suit)

See if this works
=SUMPRODUCT((Sheet4!A1:A100=Sheet3!A5)*(Sheet4!C1:AC100>=B1)*(Sheet4!C1:C100<=B2))

M.
 
Upvote 0
oops... typo

Try
=SUMPRODUCT((Sheet4!A1:A100=Sheet3!A5)*(Sheet4!C1:AC100>=B1)*(Sheet4!C1:AC100<=B2))

M.
 
Upvote 0
Hi Marcelo,

That didn't work. Maybe I can email you the file. But i was wondering if the formula (Sheet4!C1:AC100>=B1)*(Sheet4!C1:AC100<=B2)) finds any entry in April.

A= 201, B1= 4/1/2019, B2=4/30/2019
 
Upvote 0
Worked perfectly for me

Sheet1

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[TD="bgcolor: #DCE6F1"]
D
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD][/TD]
[TD]
04/01/2019​
[/TD]
[TD][/TD]
[TD]
Result​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD][/TD]
[TD]
04/30/2019​
[/TD]
[TD][/TD]
[TD]
13​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Formula in D2
=SUMPRODUCT((Sheet4!A1:A100=Sheet3!A5)*(Sheet4!C1:AC100>=B1)*(Sheet4!C1:AC100<=B2))

Sheet4

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[TD="bgcolor: #DCE6F1"]
D
[/TD]
[TD="bgcolor: #DCE6F1"]
E
[/TD]
[TD="bgcolor: #DCE6F1"]
F
[/TD]
[TD="bgcolor: #DCE6F1"]
G
[/TD]
[TD="bgcolor: #DCE6F1"]
H
[/TD]
[TD="bgcolor: #DCE6F1"]
I
[/TD]
[TD="bgcolor: #DCE6F1"]
J
[/TD]
[TD="bgcolor: #DCE6F1"]
K
[/TD]
[TD="bgcolor: #DCE6F1"]
L
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
201​
[/TD]
[TD][/TD]
[TD]
12/29/2018​
[/TD]
[TD]
12/30/2018​
[/TD]
[TD]
12/31/2018​
[/TD]
[TD]
04/01/2019​
[/TD]
[TD]
04/02/2019​
[/TD]
[TD]
04/03/2019​
[/TD]
[TD]
04/04/2019​
[/TD]
[TD]
04/05/2019​
[/TD]
[TD]
04/06/2019​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
6
[/TD]
[TD]
201​
[/TD]
[TD][/TD]
[TD]
12/29/2018​
[/TD]
[TD]
12/30/2018​
[/TD]
[TD]
12/31/2018​
[/TD]
[TD]
04/01/2019​
[/TD]
[TD]
04/02/2019​
[/TD]
[TD]
04/03/2019​
[/TD]
[TD]
04/04/2019​
[/TD]
[TD]
04/05/2019​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
7
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
8
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
9
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
10
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
11
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
12
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
13
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
14
[/TD]
[TD]
201​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
12/31/2018​
[/TD]
[TD]
04/01/2019​
[/TD]
[TD]
04/02/2019​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
15
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Sheet3!A5 = 201

M.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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