Count if consecutive value is repeated 3 times.

leehy1

New Member
Joined
Jul 4, 2023
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
Hi All,

I need help writing a formula, I've googled alot and feel like I'm getting pretty close with the solution from here: Counting MAX number of consecutive blank cells

Below is a sample table of data to illustrate my example.
1 Jan2 Jan3 Jan4 Jan5 Jan6 Jan7 Jan8 JanRefund ($10/day)
Student A01000011$40
Student B10101001$0

I am trying to determine how much I need to refund the parents based on the attendance sheet exported from the student management software. 0 being absent, 1 being present

We will only refund if student is absent consecutively for 3 or more days ($10/day).
For eg, if student absent for 2 consecutive days = no refund, absent 3 consecutive days = $30, and so on

How should I write my formula in the refund column to do that? thanks!!!
 

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.
Is it what you need?
Book1
ABCDEFGHIJKLMNO
101-Jan02-Jan03-Jan04-Jan05-Jan06-Jan07-Jan08-Jan09-Jan10-Jan11-Jan12-Jan13-JanRefund ($10/day)
2Student A010000111000080
3Student B10110011001110
4Student C110000011100150
Sheet1
Cell Formulas
RangeFormula
O2:O4O2=SUM(IFERROR(3+SQRT(FREQUENCY(IF(B2:N2=0,COLUMN(B2:N2)),IF(B2:N2<>0,COLUMN(B2:N2)))-3)^2,0))*10
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0
Another option
Fluff.xlsm
ABCDEFGHIJ
101-Jan02-Jan03-Jan04-Jan05-Jan06-Jan07-Jan08-JanRefund ($10/day)
2Student A0100001140
3Student B101010010
Master
Cell Formulas
RangeFormula
J2:J3J2=LET(d,B2:I2,s,SEQUENCE(,COLUMNS(d)),f,FREQUENCY(IF(d=0,s),IF(d<>0,s)),SUM(FILTER(f,f>=3,0))*10)
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,214
Members
449,091
Latest member
jeremy_bp001

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