I'm a newbie on here and I'm struggling to do a formula on Excel,
I basically need If;
F7= Int 0 then J7=Int 1
or
F7=Rus 0 The J7=Rus 1
or
F7=Red 0 then J7=Red 1
F7 has data validation so I can choose from either Int 0 / Rus 0 / Red 0 and I need J7 to follow suit with either Int 1 /Rus 1 /Red 1 depending on what F7 is.
This all seemed so easy to explain in my head lol so I apologize
I can do it when there are 2 outcomes ie a true or false but because there are 3 I'm struggling.
How about this:
=LEFT(F7, 4) & MID(F7, 4, 100)+1
Based on your last sentence about 3 if() statements, try this:
=IF(Test1,result1,IF(Test2,result2,result3))
Related
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 am analysing some data in Excel where the results are shown in rows of cells, such as follows:
0 0 0 1 1 1 1 2 2 2 1 1
0 0 -1 -1 0 0 -1 -1 -2
(for both examples above lets say first cell is A1)
I am looking for help to find a formula can identify where a sequence in any row goes from either -1 to 0 or -1 to -2, and the result returns either a 1 for true and a 0 for false. Any help with this appreciated!
This will return false for the first example and true for the second. I am assuming your first example is in A1:L1 and your second is in A2:L2
=OR(AND(INDEX(A1:L1,,1)=-1, INDEX(A1:L1,,COUNT(A1:L1))=0), AND(INDEX(A1:L1,,MATCH(1, --(A1:L1<>0),0))=-1,INDEX(A1:L1,,COUNT(A1:L1))=-2))*1
This needs to be entered with Ctrl+Shift+Enter
However, I don't think your criteria is a logical test as logically both of these should fail (I'm assuming you've provided at least one example of your data that should pass)
I'm new to array formulas in Excel and my brain has been trained in R for too long, so I'm sorry if this question is simple or too specific. I have data that looks like this:
ID Iteration Value Group1 Group2
2 1 100 0 0
2 2 85 1 0
2 3 28 0 0
3 1 94 1 0
5 1 83 0 1
5 2 50 1 1
6 1 94 0 0
6 2 28 1 0
I want to use array formulas to query the data in a few different ways. I want to:
For each ID, find the first iteration that has Group1 = 1.
For each ID, what is the maximum value when Group1 = 1.
For each ID, how many iterations of Group1 = 1 did it take to get to the maximum value when Group1 = 1.
I've figured out how to specify the maximum for each ID via: {=MAX(IF(A:A=A2,C:C))}
Any assistance would be appreciated. I've gone through a few quick tutorials so far, and I'm willing to look through any other good resources you may know of.
Have a look at this and tell me what you think - particularly for question 3
My setup looks like this
All formulas drag down and they are as follows:
Formula in B14 (Question 1)
{=INDEX($B$2:$B$9,MATCH(1,($A$2:$A$9=A14)*($D$2:$D$9=1),0))}
Formula in G14 (Question 2)
{=MAX(($A$2:$A$9=$F14)*($D$2:$D$9=1)*$C$2:$C$9)}
Formula in K14 (Question 3)
{=SUM(($A$2:$A$9=J14)*($C$2:$C$9=G14)*$B$2:$B$9)}
Update
If you want to know how many times in ID=2 that Group1=1 before we reach the maximum we found for ID =2 in question 2, then I'd proceed like this:
Add another column to your data, I labeled it: Group1 Passes. Placing this in the new column, F2, and drag down.
=COUNTIFS($A$2:A2,A2,$D$2:D2,1)
You can then use the following in K14
=SUM(($A$2:$A$9=J14)*($C$2:$C$9=G14)*($D$2:$D$9=1)*$F$2:$F$9)
I probable have a simple question if you know the answer to it, but I'm kind off stuck myself and I wasn't able to find anything about it on the internet.
So, I have a excel sheet like the following:
Stop? Number
0 2
0 5
1 7
0 3
1 0
0 12
0 1
0 1
1 4
Totals
1st 14 (2+5+7)
2nd 3 (3+0)
3th 18 (12+1+1+4)
As you may already have noticed, I need to count the numbers in the Number colum until I find a 1 in the Stop colum, and save those within the 'fist'/'2nd'/'3th'/etc..
I have tried a lot of other solutions and own ideas but nothing lead to the correct answer.
I hope someone can help me,
Thanks,
Merijn
You can use a helper column and SUMPRODUCT. With reference to the figure, the important formulas are:
C2: =1
C3: =C2+A2 (copy downwards).
F2: =SUMPRODUCT(($B$2:$B$10)*($C$2:$C$10=E2)) (copy downwards).
You could use 4 columns :
A(stop) B(cumulated stop) C(number) D(cumulated number)
0 0 2 2
0 0 5 7
1 1 7 14
0 1 3 3
1 2 0 3
0 2 12 12
0 2 1 13
0 2 1 14
1 3 4 18
B :
B(1) = A(1)
B(N) = B(N-1) + A(N)
D :
D(1) = C(1)
D(N) = IF(A(N-1)=1,C(N),D(N-1)+C(N))
1st :
INDEX($D$1:$D$9, MATCH(1,$B$1:$B$9, 0))
2nd :
INDEX($D$1:$D$9, MATCH(2,$B$1:$B$9, 0))
3rd :
INDEX($D$1:$D$9, MATCH(3,$B$1:$B$9, 0))
Hope this helps !