Excel Calculations - excel

Is there a way I can have an excel track the number of times a number has been entered? For instance, if the number 1 is entered into a column 10 times it would display that in the legend. And if the number 10 was entered into a column 2 times it would display that total in the legend.
The goal is to track each number as a unique integer 1 - 35.

You can use =COUNTIF(A:A,"10") to count the number of 10s in Column A.
But you'll need 35 COUNTIF functions in 35 cell, and that only for 1 Column.
How do you plan to display that Legend?

Related

Count with grouping in Excel VBA

How to use code to find the row than display negative value in group and count?
For example, in row 10 display got 2 count shortages and row 13 display 3 count of shortages.

Find row when Cumulative sum reaches certain value with condition

I have a table with 3 columns Date, Item and Number. Each row indicates how many items of each Item was received on that date. I am trying to find the date on which cumulative sum reaches 100 or more in that month. Each month will have a target for each item which will be saved in another sheet but for simplicity we can assume that its a fixed number of 100.
Example Data:
Date Item Number
1/2/2018 A 10
2/2/2018 B 10
2/2/2018 A 15
5/2/2018 C 25
6/2/2018 A 50
7/2/2018 B 10
7/2/2018 C 10
8/2/2018 A 25
9/2/2018 A 20
I am looking for the formula which should act on the data similar to above and give the result as 8/2/2018 which is the date on which the cumulative sum for Item A reached 100.
Each month will have different target number, and will have different number of entries.
I have tried using SUMIF and adding a additional column etc but this data is just part of a big data and each item limit is saved in a different sheet etc which is not easy to merge. Thanks in advance for help.
In Excel only, you can use Offset to develop an array of items and numbers containing 1,2,3...9 rows and then SUMIF to add each of them up. Then use Match to find the first one =100 and Index to find the matching date (in F2):
=INDEX(A2:A10,MATCH(100,SUMIF(OFFSET(B2,0,0,TRANSPOSE(ROW(A2:A10))-ROW(A1)),"A",OFFSET(C2,0,0,TRANSPOSE(ROW(A2:A10))-ROW(A1))),0))
Must be entered as an array formula using CtrlShiftEnter.
EDIT
To find the first sum which is >=100 (in G2):
=INDEX(A2:A10,MATCH(TRUE,SUMIF(OFFSET(B2,0,0,TRANSPOSE(ROW(A2:A10))-ROW(A1)),"A",OFFSET(C2,0,0,TRANSPOSE(ROW(A2:A10))-ROW(A1)))>=100,0))
Sum which reaches exactly 100
Sum which does not reach exactly 100 (the number in row 9 has been changed to 24):

Excel: count the number of cells in a column until their sum is greater than a set value

I have a list of consecutive events in one column and their durations in the adjacent column. I want to count the number of times a particular event occurred in a certain length of time.
For example:
Col Event Duration
1-- Contr 8
2-- Relax 5
3-- Contr 12
4-- Relax 6
5-- Contr 10
6-- Relax 5
In this example I want excel to start from row 6 and go backwards, summing durations until the value is over 30 and return the number of times Contr occured over that time period. Here the answer is 2.
Here's a link to an example spreadsheet with more realistic values: https://1drv.ms/x/s!AiOl_zwCwrAmgcgQqCPaOY5WzMZTGQ
(The threshold value would be 900 instead of 30.)
Thanks. Hope I asked the question right.
I would have to use a helper column to work out the totals under the current row. I don't mind if the sum including the current row is 30 or more, as long as the sum under it is less than 30.
So in D2:-
=SUM(C3:C$100)
Then it's just a countifs:-
=COUNTIFS(B2:B100,"Contr",D2:D100,"<"&30)

how to separate values in a column in excel

I have an excel file with two columns time and output.
output column consist of two values 1 and 2.
I want to make a calculate total time output 2 last in continuity i.e end time -start time.
for example
time output total
2 2 4-2=2
4 2
6 1
8 2 10-8=2
10 2
12 1
14 1
16 1
18 2 22-18=4
20 2
22 2
Is there some easy way to so this as my data file is very large
Try this in C2 and copy down:
=IF(AND(B2=2,B1<>2),INDEX($A2:$A$30000,MATCH(1,$B2:$B$30000,0)-1)-A2,"")
The only caveat is that the last value in column B needs to be a 1. Or it will not do the last calculation correctly.
If you have Excel 2010 or later this formula does not care about the last values in column B. But depending the number of rows it will be slower in the calculations.
=IF(AND(B2=2,B1<>2),INDEX(A:A,AGGREGATE(15,6,ROW(2:$13)/($B2:$B$13 <>2),1)-1)-A2,"")
But it does require that the last row in the specified ranges be at least one larger than the last data row. It can be thousands larger, but that adds calculation times.

Quantifying conditional duration of values in excel

I am trying to analyze blood pressure that is taken every minute, and determine how long the values are within a certain range, consecutively. I have the data set up in excel for the moment. I have color coded the values based on the ranges I would like to quantify. I know that if I do a simple "=countIF) function I can get the total number of times these values meet the criteria. But what I want to do next is quantify for how long the values fall within a specified range, consecutively.
This shows values in columns in excel, where each column is a different patient, and the heat map are the value conditions to help me visualize if certain thresholds occur for longer times than others. But I want to find a way to quanitify this in excel, if possible. Any help would be much appreciated.
The final result I am looking for is to be able to measure how much time each patient sustains a specific category of blood pressure to know if certain ranges are more prolonged than others (e.g. blood pressure is between 120-130 for 30 minutes). So in the spreadsheet above, assuming each cell is a 1-minute bin, for column HU, BP is between 120-130 for 3 minutes (rows 2-4), and again for 16 minutes (rows 6-22). In column HS, blood pressure is above 140 (black) for 7 minutes.
I want to find a workflow to quantify these durations so that I can get a summary of the number of consecutive 1-minute bins (each cell) at a specified range/threshold for each patient (column)
First, I would create another sheet -- let's call it "Thresholds" -- with thresholds of bloodpressures in ascending order in column A.
Put a category number next to each value (in column B)
For example:
0 0
90 1
100 2
105 3
110 4
115 5
120 6
125 7
... etc.
Back in the other sheet, add a new column next to each bloodpressure column. So you
would have a new column HR next to HQ.
Put there a formula that looks up the category for the value in HQ, from sheet "Thresholds".
You can use VLOOKUP for that. For example in row 2:
=VLOOKUP(HQ2, Thresholds!$A$1:$B:$1000, 2)
Then add yet another column, HS it will be.
In there make a running count for same category rows, like this (for row 2, I assume you have used row 1 for column titles):
=IF(HR1<>HR2, 1, HS1+1)
Drag down this formula to the column. This formula checks if this row has a different category of blood pressure than the previous one. If so, it
sets the counter to 1 (it is the first instance in this running series). In the other
case it takes the value of the counter in the previous row and adds 1 to it.
Repeat this for the other columns (inserting 2 new columns next to each).
This will already give you a start for further analysis.

Resources