Count if query

Sliepner

New Member
Joined
Aug 20, 2018
Messages
6
I am wondering if someone can help assemble a formula. I have a rota and wish to count the amount of people on night shift. Easy enough to separate and total them with a "countif" however, when people mobilise, instead of the usual "NS" for nightshift or "1" for Day shift, we now have the addition of "M*" (1,2,3 or 4), again not really an issue, can use "Left" or "M*", but I need to only count those who will be on nightshift, and that information will be in the next column. e.g. per snip on 14th July, we have 3 people mobilising, 1 on days, 2 on nights. How can I build a formula to count the n/s who mobilise. Any help appreciated.
1626600173567.png
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi Sliepner,

I'm not following as there are 4 two character entries for 14 July. Does the number indicate some kind of shift? Where should the count go and is it by Mobilize type or just a single count.

Could you show a worked example with results so we can test.

Is it something like this?

Sliepner.xlsx
EFGHIJKLMNO
112-Jul13-Jul14-Jul15-Jul16-Jul17-Jul18-Jul19-Jul20-Jul21-Jul
2M211111
31111D2
4M21
5M3111
6
7NSD1
8ELELD2
9M2NSNSNS
10M2NSNSNS
11
12Mobilized NS0020000000
Shifts
Cell Formulas
RangeFormula
G1:O1G1=F1+1
F12:O12F12=COUNTIFS(F$2:F$10,"M*",G$2:G$10,"NS")
 
Upvote 0
Solution
Thanks for the response, what I ended up doing was:
=COUNTIF(H2:H11,"NS")+COUNTIFS(H2:H11,"m*",J2:j11,"NS")
In effect the entries represent as follows: M* what time they mobilise, 1 = Dayshift, NS = Nightshift, D* what time they demob. So I needed to count those who were on nightshift, including those who had mobilised on the day. I had forgotten about countifs.
 
Upvote 0

Forum statistics

Threads
1,214,575
Messages
6,120,344
Members
448,956
Latest member
Adamsxl

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