Need Help - Count the # of times a change (data) occurs in a range of cells

jgtubbs

New Member
Joined
Apr 6, 2023
Messages
2
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
  2. Web
Hello MrExcel Members,

I have an issue that is beyond my scope of excel skills. I need to determine how many times , the equipment "fails" over a specific date range. Basically, when the "status" goes from "In-Service" to "OOS" only. For example: Row 2, I have highlighted "when a failure" occurs and no matter how long the failure lasts, only the initial "failure" counts as "1". A formula to count such over a large range of columns and rows, would be most helpful. Thank you for any assistance.
1680810930657.png
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Welcome to the Forum.

I think this works. There are probably better ways, but try this out.

MrExcel posts20.xlsx
DEFGHIJKLMN
2Changes fromIn Service
3toOSS
4
5
61/23/20231/24/20231/25/20231/26/20231/27/20231/28/20231/29/20231/30/20231/31/20232/1/2023Failures
7In ServiceOSSOSSIn ServiceIn ServiceIn ServiceOSSIn ServiceIn ServiceIn Service2
Sheet14
Cell Formulas
RangeFormula
N7N7=SUM(--(INDEX(D7:M7&TRANSPOSE(D7:M7),SEQUENCE(COUNTA(D7:M7)-1)+1,SEQUENCE(COUNTA(D7:M7)-1))=N2&N3))
 
Upvote 0
Hi & welcome to MrExcel.
Another option
Excel Formula:
=COUNTIFS(C2:K2,"in service",D2:L2,"OSS")
 
Upvote 0
Welcome to the Forum.

I think this works. There are probably better ways, but try this out.

MrExcel posts20.xlsx
DEFGHIJKLMN
2Changes fromIn Service
3toOSS
4
5
61/23/20231/24/20231/25/20231/26/20231/27/20231/28/20231/29/20231/30/20231/31/20232/1/2023Failures
7In ServiceOSSOSSIn ServiceIn ServiceIn ServiceOSSIn ServiceIn ServiceIn Service2
Sheet14
Cell Formulas
RangeFormula
N7N7=SUM(--(INDEX(D7:M7&TRANSPOSE(D7:M7),SEQUENCE(COUNTA(D7:M7)-1)+1,SEQUENCE(COUNTA(D7:M7)-1))=N2&N3))
Thank you so very much!! This was perfect!!! Much Appreciated! :)
 
Upvote 0
Thank you so very much!! This was perfect!!! Much Appreciated! :)
You're welcome. But I think Fluff's simple answer is far superior. I don't know why it works, but it sure is better.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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