In Excel aggregate values from a column if the following values are larger than zero - excel

I would like excel to iterate through a column of precipitation values and keep adding them as long the value is larger than zero. The table for example looks like this with the required result in NewCol.
Date prec NewCol
x 10 10
x 8 18
x 3 21
x 0 0
x 1 1
x 0 0
I would like to use the value 21 (and all other values with largest values) to assess consequtive rainfall days. Wondering if this is possible in Excel? Haven't been able to find the solution in Mathlab.
Thanks in Advance!

Related

Excel Formula for finding Y maximum in a given X range

I have an XY table in excel. I would like to find the maximum Y value in a given X range. Example data given below. What equation can I use, in an unrelated cell, to output the max Y value in between the X range 2:6
X
Y
1
4
2
7
3
0
4
8
5
4
6
3
Using MAXIFS:
=MAXIFS(B:B,A:A,">=2",A:A,"<=6")
As noted by #ScottCraner, if your version of Excel does not support MAXIFS, see this thread for alternatives.
I understand your question so:
you want the biggest number in column Y which also is present in X
=MAXIFS(B2:B7;B2:B7;">="&MIN(A2:A7);B2:B7;"<="&MAX(A2:A7))

Excel - assign values based on the first unique item

I have got an excel question that I can not answer. Here is my table:
ID Key Count Unique Available Text Results
1 0 Text-1 Dupe-Y
2 1 Y Text-1 Y
3 0 Text-1 Dupe-Y
4 0 Text-1 Dupe-Y
5 1 N Text-2 N
6 1 Y Text-3 Y
7 0 Text-2 Dupe-N
8 0 Duplicate Text-2 Dupe-N
9 0 Duplicate Text-2 Dupe-N
10 0 Y Text-2 Dupe-N
Id Key is just unique key.
Count unique picks up the first time each value in column Text appears. Available can have Y, N, Duplicate and Text is the main column I need to analyze my table. The Results are for the first time each value in Text appears (Count unique = 1), if there is a value in Available then that is the value I need, if Count Unique is 0 then is either Dupe-Y or Dupe-N depending on the value in Available.
I tried with a formula like this one but got stuck after initial progress. =IF(B2=0,"",IFERROR(IF(COUNTIF(D:D,D2)>1,IF(COUNTIF($D:$D,D2)=1,"",C2),1),1))
Note that the column Results is the one I need to populate with a formula that is not affected by sorting or lack of it.
I guess you got all those values and you just need a formula for column Results.
My formul will work only if the data is sorted like in your example. If sorting changes, formula will fail:
My formula is:
=IF(B2=1;D2;"Dupe-"&RIGHT(G1;1))

I want to sum the total amount of consecutive numbers (similar to a count of consecutive numbers attached)

In this article there is directions on determining the number of consecutive cells greater than 0. I want to do something similar, but instead of simply counting the number of consecutive columns there are, I want to sum them up.
For example, 0 0 0 1 2 0 0 5 would be 3 (1+2=3)
Edit: If for example, there is multiple max consecutive numbers (e.g., 0 0 1 3 0 0 4 5) I would want the highest sum (9) to be chosen.
Edit2: The data is set-up in rows (X axis is months I need to sum for consecutives and Y axis is "user") so the formula would match the examples I've given above.

Conditional formatting in Excel for totals

X Y Z
1 5 0
1 4 0
1 9 1
2 5 0
2 4 0
2 **8** 1
Basically, I have an excel table with 3 variables. X is an group variable, Y is a value, and Z is a dummy variable that indicates if the Y value in that row is a total or not. Is there any way to write the conditional formatting rule so that discrepancies between SUM(Y) over the same X, and the supposed total are highlighted?
In the table above, The third row with X would not be marked because 5+4=9, so there is no discrepancy, but the 6th row would be marked because 5+4!=8, so that one should be highlighter. I appreciate your help!
Use SUMIFS();
Assuming your data starts in A1
=AND(SUMIFS($B:$B,$A:$A,$A1,$C:$C,0)<>$B1,$C1=1)
Apply it to B:B.

Is there any range or between kind of function in Excel?

I have a table with three columns in Excel, a,b and c.
One cell has a numeric value X [say 25], I need to get the value in the c column such that X should be in between min and max column. For X=25 the value in c is "20" since X is between the min and max values for the 5th table row.
I'm looking for a range or between kind of function, but couldn't find a function with either name.
a b c
-----------------------------
min max improvements
0 1 70
2 5 60
6 10 50
11 20 30
21 30 20
31 40 10
41 80 5
You want to look up in that table of yours which improvement value is correct if some value is "25"; in this case that would mean to match line 5 of your table and return the value 20.
You are looking for VLOOKUP, e.g.
=VLOOKUP(B12;A2:C8;2)
giving
(edit: fixed stupid typo in formula and image, now giving correct result)

Resources