Count occurances of a specific cell value in a changing rang of cells

Acluett

New Member
Joined
Oct 28, 2016
Messages
3
Row 1 contains several hundred columns of data.
I need to see if a specific character appears 4 times in a set of 28 columns

ie. column 1 to 28, row 1 how many times does 'X' appear, Col 2 to 29 how many times does x appear, col 3 to 30 how many times does 'X' appear, etc etc

The basic reason might help. in any 28 day cycle an employee is required to have at least 4 days off.

The col's represent days, so 365 col's will have data. if the employee worked that day, an 'X' is in that cell, if not "-" is in the cell
I need to count how many times an employee had a day off in each 28 day period

Thanks, I know this is a toughy
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Row 1 contains several hundred columns of data.
I need to see if a specific character appears 4 times in a set of 28 columns

ie. column 1 to 28, row 1 how many times does 'X' appear, Col 2 to 29 how many times does x appear, col 3 to 30 how many times does 'X' appear, etc etc

The basic reason might help. in any 28 day cycle an employee is required to have at least 4 days off.

The col's represent days, so 365 col's will have data. if the employee worked that day, an 'X' is in that cell, if not "-" is in the cell
I need to count how many times an employee had a day off in each 28 day period

Thanks, I know this is a toughy

Where do you want the values to appear? What controls which 28 columns are we looking at?
If the X's are in row 1.
You can put this in A2:
Code:
=IF(COUNTIF(A1:AB1,"X")=4, "4 Times", IF(COUNTIF(A1:AB1,"X")>4, " Over 4 Times", "Under 4 Times"))

and as you drag it to the cells to the right it will update.
 
Last edited:
Upvote 0
Welcome to the forum.

That's not a toughy - it's easypeasy. Put this in Cell AB1 and copy right as far as necessary.

Code:
=COUNTIFS(A1:AB1,"X")
 
Upvote 0
but that will count all of the occurences, I only want to count in sequental groups of 28

for example in column #1 there is nothing, column #2 thru column 366 there are either 'x's or '-'s
I need col 1 to sum the total times that their are more than 4 '-''s in a sequential section of cols

IE so for columns 2 thru 29, if there are less than 4 '-'s then col 1 gets 1
columns 3 thru 30, if there are still less than 4'-' than col 1 add 1
Columns 4 thru 31, less the 4'-''s add to col 1 again and so on
 
Upvote 0

Forum statistics

Threads
1,216,110
Messages
6,128,896
Members
449,477
Latest member
panjongshing

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