Count of consecutive 02 days OFF and 04 days OFF

Bahadur22

New Member
Joined
Oct 31, 2022
Messages
5
Office Version
  1. 2019
Platform
  1. Windows
Dear Excel Guru's Kindly need your help to get the consecutive 02 days OFF and 04 days OFF count for my staff roster separately.
I want to get the values as shown in green cell. Attached excel file is for your reference and above image as well.

Days_OFF_Formula_Help.xlsx
CDEFGHIJKLMNOPQRST
1
2Result Needed
3Name01-Nov02-Nov03-Nov04-Nov05-Nov06-Nov07-Nov08-Nov09-Nov10-Nov11-Nov12-Nov13-Nov2 Consective OFF4 Consective OFF
4JackMMMMMOFFOFFMMMOFFMM10
5MikeMMMMMOFFOFFOFFOFFMMMM01
6TimMMMMOFFOFFMMMMMOFFOFF20
7
8M09:00 - 17:00
9
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F8Cell Valuecontains "M"textNO
F8Cell Value="OFF"textNO
D4:P6,G8Cell Valuecontains "M"textNO
D4:P6,G8Cell Value="OFF"textNO
 

Attachments

  • Excel.PNG
    Excel.PNG
    10.7 KB · Views: 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
answered on other forum

also here with a search
 
Upvote 0
One way using Power Query.

Book1
ST
32 Days4 Days
410
501
620
Sheet3


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    UOP = Table.UnpivotOtherColumns(Source, {"Name"}, "Attribute", "Value"),
    GroupOuter = Table.Group(UOP, {"Name"}, {{"Count", each _, type table [Name=text, Attribute=text, Value=text]}}),
    GroupInner = Table.TransformColumns(GroupOuter,{{"Count", each Table.Group(_,{"Value"}, {{"Group", each Table.RowCount(_)}},GroupKind.Local)}}),
    SelectOff = Table.TransformColumns(GroupInner,{{"Count", each Table.SelectRows(_, each _[Value]="OFF")}}),
    Twos = Table.AddColumn(SelectOff, "2 Days", each List.Count(List.Select([Count][Group], each _ =2))),
    Fours = Table.AddColumn(Twos, "4 Days", each List.Count(List.Select([Count][Group], each _ =4))),
    ROC = Table.SelectColumns(Fours,{"2 Days", "4 Days"})
in
    ROC
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Count of Consecutive Days OFF Formula
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,215,543
Messages
6,125,429
Members
449,223
Latest member
Narrian

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