For the same Project_Id if the first cell (in ‘Success’) is 1, than make all ‘output’ cells for that matching project_id a 1….
And for the same Project_Id if the first cell (in ‘Success’) is 0, than make all ‘output’ cells for that matching project_id a 0….
I had previous used:
IF((COUNTIFS($A:$1:A1,A1,$B$1:B1,0)),0,1)
However this is not correct as it does the following: if there are ANY 0’s in the range, than make it 0.
i have also tried this: =IF(MIN(IF($A$2:$A$9=A2,$B$2:$B$9))=1,1,0)
however it does not work properly particularly in cases where it should give a 1... not a 0...
Would appreciate some help!!
column A
column B
column C
Project_Id
Success
output
1
1
1
1
0
1
1
0
1
2
0
0
2
1
0
2
1
0
2
1
0
2
1
0
2
1
0
Since all values would be available, alternatively use VLOOKUP():
Formula in C2:
=VLOOKUP(A2:A10,A2:B10,2,0)
XLOOKUP() can give you desired output. Try-
=MAP(A2:A10,LAMBDA(x,XLOOKUP(x,A2:A10,B2:B10,"",0,1)))
Single XLOOKUP() will also work, like-
=XLOOKUP(A2:A10,A2:A10,B2:B10,"",0,1)
To make input argument dynamic can use A2:INDEX(A2:A50000,COUNTA(A2:A50000)). Try-
=XLOOKUP(A2:INDEX(A2:A50000,COUNTA(A2:A50000)),A2:A10,B2:B10,"",0,1)
I have used MAP() for dynamic spill results.
Related
I have an arbitrary number of columns, one for each period a course is offered, in chronological order, and an arbitrary number of rows, one for each unique participant. The values are '1' for participation in that month, '0' for non-participation.
Fall2019 Spring2019 Fall2018 Spring2018 Fall2017
1 1 0 1 0
0 1 1 1 1
0 1 1 1 1
0 1 1 1 1
0 1 0 1 1
0 1 1 0 0
0 1 1 0 0
0 1 1 0 0
1 0 0 0 0
I would like to take a sum, at the bottom of each column, for how many participants were first time attendees that period, i.e. the sum of '1's where all values in the row to the right of that '1', are '0'.
In the given example set, Spring2018 should sum to 1, Fall2018 should sum to 3.
Something like the formula below will work for 'Spring2018' when there is just one previous column to compare:
=SUMPRODUCT((D2:D9)*(E2:E9=0))
But this formula cannot be 'autofilled' or extended across multiple columns... i.e. none of these variations work:
=SUMPRODUCT((C2:C9)*(D2:$E9=0))
=SUMPRODUCT((C2:C9)*(SUM(D2:$E9)=0))
=SUMPRODUCT((C2:C9)*(SUMIF(D2:$E9,"0")))
And while it will work, I do NOT want to have to manually create extended versions of this formula e.g.
=SUMPRODUCT((C2:C9)*(D2:D9+E2:E9=0))
=SUMPRODUCT((B2:B9)*(C2:C9+D2:D9+E2:E9=0))
... and so on
I have tried several variations on arrayformula, sumproduct, and sumif, but I'm really stuck. Any assistance is appreciated.
use this array formula:
=SUM(A2:A10*(MMULT(--(B$2:$E$10=1),TRANSPOSE(COLUMN(B$2:$E$10)^0))=0))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
My goal is to count and potentially conditionally format the occurrences when a certain number of days pass with 0 sales.
I am trying to return the number of times 0 is repeated consecutively 3 or more times. So for this example I would like to see the return value of 3. So far I can't wrap my brain around how to do this, any ideas?
1
5
0
0
0
0
0
2
0
0
1
0
2
0
0
0
5
0
0
0
0
Thanks!
So #Barry Houdini's method applied to this problem would give
=SUM(--(FREQUENCY(IF(A1:A21=0,ROW(A1:1A21)),IF(A1:A21>0,ROW(A1:A21)))>=3))
entered as an array formula using CtrlShiftEnter
If you wanted to make it more dynamic and exclude blanks you could use
=SUM(--(FREQUENCY(IF(A1:A100<>"",IF(A1:A100=0,ROW(A1:A100))),IF(A1:A100>0,ROW(A1:A100)))>=3))
How about you make a help column with a simple sum formula with a "window" of three rows (or whatever you need). Then you conditionally format all values which are 0 in that column. That should provide you with the information you are looking for.
I am just using formulas in excel and was wondering how you could count all the 0s until a 1 is reached, and then start the process over again, based on subject number. If this is not possible simply with formulas, how could I write a VBA code for this?
Right now I am trying to use,
=IF(OR(F4=0,F3=1),"",COUNTIFS($A$2:A2, $A$2,$F$2:F2,0)-SUM($I$2:I2))
which I input in I3 and I change the COUNTIFS($A$#:A#, $A$#...) part for each subject number.
This seems to work with the exception of the last grouping, as it won't output a number before the next subject.
Example Data:
subid yes number_yes(output)
1 0
1 0
1 0 3
1 1
1 0 1
1 1
1 0
2 0
2 0 2
2 1
2 0
2 0
3
etc.
A blank cell is numerically zero and that is one of your accepted conditions. Differentiate between blanks and zero values.
=IF(and(f4<>"", OR(F4=0,F3=1)),"",COUNTIFS($A$2:A2, $A$2,$F$2:F2,0)-SUM($I$2:I2))
Based on #Jeeped answer. If you use -SUMIF($A$2:A2,A3,$I$2:I2) instead of -SUM($I$2:I2) you don't need to adjust this part for each subject number. Just use the following formula in I3 and copy it down.
=IF(AND(F4<>"",OR(F4=0,F3=1)),"",COUNTIFS($A$2:A3,A3,$F$2:F3,0)-SUMIF($A$2:A2,A3,$I$2:I2))
Note that I also changed the second parameter in the COUNTIFS to A3.
I'm looking for a way to find the first specific value above a certain cell.
Using the example below, in the result column every time I hit a A in COL2, I need to substract the value in COL1 to the first A value above.
The trouble seems finding a way to keep the range dynamic...
I thought of =IF(B5="A";A5-INDIRECT("A"&MATCH("A";B:B;0));"")
But of course that only works for the first one as Match will always pick up the first one.
Any ideas? Thanks!
Example :
COL1 COL2 Result
1 A
2 0
3 0
4 A 4 - 1 = 3
5 0
6 A 6 - 4 = 2
7 0
8 0
9 0
10 A 10 - 6 = 4
Try this:
=IF(AND(ROW(B2)<>2,B2="A"),A2-INDEX($A$1:$A1,AGGREGATE(14,6,ROW($1:1)/($B$1:$B1="A"),1)),"")
The AGGREGATE() Function was introduced in 2010.
In D2 enter =IF(B2="A",A2-INDIRECT("A"&MATCH("A"&(E2-1),F:F,0)),"")
In E2 enter =IF(B2="a",COUNTIFS($B$2:B2,"a"),"")
In F2 enter =B2&E2
Copy formulas from D, E and F down all your rows
Column D is the result you're looking for
I have an Summary sheet set up data set up as follows-
Cat A Cat B Cat C Cat D
Name 1 0 0 0 0
Name 2 2 3 2 2
Name 3 2 2 2 2
Name 4 3 2 2 3
Name 5 2 3 2 3
I also then have separate tabs for each of Name1 through to Name 5.
The summary sheet contains the maximum values for each category from each tab. So the Cell at Cat A Name 1 should show the maximum value on Sheet(Name1) in the Cat A column.
So far so good. However each tab may not contain the same categories, so therefore I would like teh summary sheet to check the maximum value in each column by doing a search on the Cat name.
So far I have this-
=MATCH(Overview!S$1,Name1!$C$1:$V$1,0)
Which returns the column number with the right Category, in this case 13. So I can find the right column. What I am struggling with is to now find the maximum value in the column.
Can anyone help?
Thanks
IAssuming your search range goes to row 1000:
=MAX(INDEX(Name1!$C$2:$V$1000,0,MATCH(Overview!S$1,Name1!$C$1:$V$1,0)))
The 0 Row argument in Index means to select the entire column.
The Offset function is your key here.
After you've got the value from the match, you can pass it to the offset to get the correct column.
So, for example, you probably want something like:
=Max(Name1!$C1:$C2000)
But you don't know whether you should use the C column or the D column or whatever, in this case, it was 13, so is that the P column? (c=3, the match was 13 so 3+13 = 16 = P?), so I think you want something like this:
=Max(Offset(Name1!$C$1:$C$2000, 0, [result of your match expression] - 1))
Here's an example of what I think you want in GoogleDocs:
https://docs.google.com/spreadsheet/ccc?key=0Ai45AJPc2AWMdGRlZXNIdlZBaHJxc01qVlJWa1N1WXc