count number of consecutive cells meeting a condition - excel-formula

In a spreadsheet, I want to count the number of consecutive rows that are meeting a condition. The counting should stop once the condition is breached.
Ex: I want to find how many rows have a number below 10 consecutively in the following data set, until a number greater than 10 appears.
8,7,11,2,3,4,6,5
In the above case, i want my answer to be 2 (and not 7), because i want the counting to stop right at the cell where 11 appears. For a better understanding of my question, please refer this Screenshot with comments.
Please let me know if there is any formula to achieve this.
Thanks in advance.

try this...
Place =IF(A1<=10,1,0) in cell C1
Place =IF(IF(AND(A2<=10,A1<=10),1+B1,0)=0,IF(A2<=10,1,0),IF(AND(A2<=10,A1<=10),1+B1,0)) in C2 and drag it tell your last cell.

Related

Count consecutive instances in column

I am tracking my days on duty and want excel to count the number of consecutive days on duty and post the totals next to the current date. I managed to insert a formula that does this but it counts in reverse order. In the attached image of the file note that on 6/13/2018 it shows 28 continuous days on duty. But that is counted from 7/10/2018 back. I want that 28 to show up on 7/10/2018. So that it counts from the previous days to the current day. Make sense????
What do I need to change in the formula to do this? Formula can be seen in the image.
Any suggestions would be appreciated
You need to build your formula the other way around:
If row r-1 has the same status as row r, then Counter_r should be Counter_(r-1) + 1. Otherwise, restart the counter - and Counter_r = 1
So, for example, in cell E3 the formula should be:
=IF(D3=D2, E2+1, 1)
I guess the picture helps a bit, but I would have preferred to see the data, even though this is simple enough to reproduce.
You probably want the formula:
=IF(AND(D2="On Duty",D2=D1),E1+1,1)
Starting in Cell E2 and copied down from there.

Excel: How do I sum cell values every nth colum

I have the following table:
and I'd like to have the total for each player but values are every 3 columns.
As you can see from the picture on the bottom part I wrote what manually I should enter.
For player 1
=SUM(D3;G3;J3...)
Player 2
=SUM(D4;G4;J4...)
and so on. What formula should I use to calculate automatically every 3 columns? I know how the MOD works but on the net I found too many examples each one using different methods and none worked so far. Can anyone help me please or point me to the right direction to understand how it works to get this data since I'll be using this a lot (get value from cell every nth column).
thanks
It looks like you should just be using SUMIFS here:
=SUMIFS(3:3,$2:$2,"TOT")
This will sum every value on row 3 (Player 1) where the value in row 2 is "TOT" (every 3rd column). Put this in cell B18 and just copy down in your column B.
Or, in case you change your column labels, you can refer to cell D2 instead of typing "TOT" in the formula:
=SUMIFS(3:3,$2:$2,$D$2)
Try this, it will total all the cells that occur every 3 columns beginning at column D. Z3 can be increased to any column you require:
=SUMPRODUCT((D3:Z3)*(MOD(COLUMN(D3:Z3)-1,3)=0))
The explanation on how it works can be found here (I advise you to bookmark this site for future references. They have many other helpful formulas and functions).
Applying this formula to your reality should be something like this for Player 1 (Not tested. Adjust the ranges as required):
=SUMPRODUCT(--(MOD(COLUMN(D3:Z3)-COLUMN(D3)+1,3)=0),D3:Z3)

Excel 2013: Count unique values or IDs in column B with a condition which needs to be filtered in column A

I am a noob in excel, hence pardon me for any mistakes made.
This question must have been answered before but I couldn't find the right string to make it work for me.
There are around 500 rows and 20 columns (Yes, it is a report)
Column A has a few values (eg: Problem, Change, Request, etc.)
Column B has ticket numbers assigned to each entry. (No, I don't work for a call center, these are Datacenter Operations tickets)
Column B has several duplicate ticket numbers, as many people worked on same ticket OR the ticket was reopened for some reason.
I wish to take a count of unique ticket numbers from Column B when the condition in Column A is Change only.
So if there are 500 ticket number 250 are duplicate for sure, and only 25% of the rest will be Change tickets.
I am not supposed to use a Pivot or filter hence asking this question.
Need a formula to retrieve the count with the condition.
I may put the formula in Sheet2 or at the extreme right column, plz don't worry about it, I will take care of those things.
Many thanks in advance.
Adding to the question,
Let me help you with some data.
Change CRQ1110001
Problem INC1110001
Change CRQ1110001
Problem INC1110001
Change CRQ1110003
Problem INC1110003
Change CRQ1110004
Problem INC1110004
Change CRQ1110004
Change CRQ1110004
Problem INC1110005
Now I wish to only consider Change here without considering duplicate values.
Maybe this helps.
Thanks again.
Based on this website count unique values and with a small change this formula should work, expand the ranges to cover your entire range.
=SUM(IF(FREQUENCY(IF(A2:A10="change",IF(LEN(B2:B10)>0,MATCH(B2:B10,B2:B10,0),""),""), IF(A2:A10="change",IF(LEN(B2:B10)>0,MATCH(B2:B10,B2:B10,0),""),""))>0,1))
Entered with ctrl+shift+enter as it's an array formula.
Note that if you do this over the entire column A:A it will take quite a bit of time to compute as it has to go through a lot of calculations in the array formula.
If your "ticket numbers" in column B are actual numbers then you can use this formula
=SUM(IF(FREQUENCY(IF(A2:A500="Change",B2:B500),B2:B500),1))
confirmed with CTRL+SHIFT+ENTER
If not numeric you need to use a version as per gtwebb's suggestion

Trying to find out how many times numbers come out in a series

I have an excel spreadsheet with number series and I want to count how many times a particular number shows up (i.e. 4)
Attached is a screenprint
!(http://i.imgur.com/kP4EZXv.jpg)
I looked for samples but no one seems to be trying to do the same thing.
Thanks in advance.
Lenny
If your array is in A1:A4, and you want to count the number of times "1" occurs, you would use:
=COUNTIF(A1:A4, "1")
I put random numbers between 0 and 100 in a1 through e5, using =RANDBETWEEN(0,100).
In another column, starting in G6, I put the numbers 1 through 100. Then in H5 I placed the formula =COUNTIF($A$1:$E$5,G6) and filled down.
It kept a count of how many times each number occurred. And every time I entered a new number, the array of numbers would update and the counts would change.
So it looks like your data is all in one column, A1:A24 all two digit numbers (with leading zeroes if required) and with numbers not repeated within individual cells, in which case you can use COUNTIF with a wildcard, e.g. to count "04" try
=COUNTIF(A$1:A$24,"*04*")
or if you want the criteria as a cell value put 4 or 21 or whatever in C2 and use
=COUNTIF(A$1:A$24,"*"&TEXT(C2,"00")&"*")

Excel Counting non blank cells

I am having no luck trying to count my non blank cells in excel. I have tried multiple formulas and I keep getting inaccurate data. Here is the situation:
I am creating a Preventative Care list for my physicians (I have 4) I created a list of all their patients that have received a letter re: Prev. Care and I am inputting who needs a second letter and who has results. Some results are negative, some are positive. I have the list set up in alphabetical order on patients last name and then I have their physician initials in the other column. I want to check to see what percentage of each doctors patients have done their prev. care. I want to calculate this separately. Unfortunately, the cells are no in order. I have tried everything to my knowledge.
Help!
This will give you how many blank cells you have. You can deduct this from the total number of cells in your column, or you could use this directly to compute your percentage as (1 - x) where x is percentage of blank cells.
=COUNTBLANK(<your column>)
E.g:
=COUNTBLANK(A1:A10)
If it's not immediately obvious how to count the total number of cells in a range, this formula should help explain, answering the original question fully. It works with ranges that span more than 1 column, too.
=ROWS(range)*COLUMNS(range)-COUNTBLANK(range)
You might try something like:
=IF(LEN(A1) > 0, 1, 0)
You can then sum that column or do whatever other calculation you need.
=COUNTIF(range,"<>"&"") will count all cells that do not have a value equivalent to "", so, basically anything that is not blank.

Resources