excel formula to display right column - excel-2007

I need an excel formula for this to produce the values on the right column. simple theory. to show when right values has jump by a certain value.
10 0
10 1
11 0
11 1
12 0
12 0
12 0
12 1
13 0
13 0

If I understand correctly, you want 1 when the next value is different, and zero otherwise?
If so, assuming your values are in column A, starting with A1, try the following formula in B1: =IF(A1=A2;0;1) then copy B1 and paste in the whole column B.
Make that =IF(ISBLANK(A2);0;IF(A1=A2;0;1)) to also return 0 if the next cell is blank.

Related

Find the third field if two fields have non zero values

My dataset -
A B C
abc 0 12
ert 0 45
ghj 14 0
kli 56 78
qas 0 0
I want to find the values of A for which values of B and C together are non-zero.
Expected output-
A B C
kli 56 78
I tried-
aggr(
sum({<[B]={"<>0"},[C]={"<>0"}>}A)
,[B],[C])
Depends where you are doing this, in the Data Load or through Set Analysis on the front, but really this will work on both the load editor and a table.
if("B" <> 0 and "C" <> 0, 'Non-Zero Value', 'Zero Value')
Example of what I created

We have age columns and in that we have single values or 15+ values we need to have single value or 15+

If source value is 3 or 4 then target value is 3 or 4. If source having any minus value then -1 and if source value is 15 or more than 15 then 15+.
Table 1 Table 2
Age column. Age column
3 3
4 4
15 15+
-2 -1
-3 -1
100 15+
you can use the CASE WHEN THEN END syntax for problems like that (https://www.w3schools.com/sql/sql_case.asp)
i assume you have 3 conditions:
negative values are always -1
up to 14 it is the original value
15 and above is 15+
that means, you have to cover these 3 cases with the CASE WHEN THEN END clause. Just evaluate what comes out from your select to the first table and then transform it to the wanted outcome

Delete rows based on value of 3 cells

I am fairly new to VBA so what I am trying to do feels almost impossible.
I have an excel sheet with three columns showing the percentage of toner left.
Black Cyan Magenta Yellow
6 45 67 100
93 93 5 19
20 40 65 57
I want to know if it's possible to create a macro to look at all three columns per row and if all the values are higher than 10, to delete the row and if any of the 3 values is below 10 to keep the row and move on to the next one.
In this case, row 2 and 3 would be kept because there's values below 10 but row 4 would be deleted.
For i = Sheet.Cells(Rows.Count, "A").End(xlUp).Row to 2 Step -1
If Cells(i, Column1).Value2 > 10 And Cells(i, Column2).Value2 > 10 And Cells(i, Column3).Value2 > 10 Then
Rows(i).Delete
End If
Next i

VBA code for algebraic calculation depending on the criteria

I want macro for:
I have 5 columns where I want like
COL 1 COL 2 COL 3 COL 4 COL5
JAN 13 0 1
JAN 12 8 7
FEB 13 7 4
FEB 14 7 5
MAR 44 10 7
now i want to calculate on col 5 = (sum of col2 values ) / (sum of col 3 values- sum of values col 4) which belongs to JAN and i want this solution to print on 1 cell of COL5
similarly for other months output should print on first cell belongs to FEB cell in col 1
Please i am very poor in this macro coding part . can someone help me to decode this one.
For better understanding of my problem i attaching image also
Put this in E2 and copy/drag down.
=IF(A2<>A1,IFERROR(SUMIF(A:A,A2,B:B)/(SUMIF(A:A,A2,C:C)-SUMIF(A:A,A2,D:D)),0),"")
You will want to change the ,0 to what every you want in place of when it tries to divide by 0.
Jan resolves to 25/0 which is an error I put 0 in for the error.

ARRAYFORMULA ON SPECIFIC CELLS

So I have this formula, it basiclly mulitiplies every value in a row for every row and sums up the products, and while thats awesome and all
=sum(ArrayFormula(iferror(A1:A*B1:B*C1:C)))
I would like if there was a way to choose what rows it multiplies and sums up, if I can put a specific letter or like tag those cells in any way and like "filter" them out so it only sums up lets say row 1,2,4 and so on and for infinity, how ever many rows Ill like to add and whichever rows I want to include!
EXAMPLE:
1: 100 4 10
2: 120 2 12
3: 125 5 10
4: 105 3 15
Not sure I fully understand the question but I believe you could solve the problem by introducing a fourth column, using "1" to indicate rows to add to the sum and "0" for rows to ignore. By extending your formula to include the new column D each row is multiplied with 1 (adding the value, since N*1=N) or 0 (ignoring the value, since N*0=0):
=sum(ArrayFormula(iferror(A1:A*B1:B*C1:C*D1:D)))
The below example data would sum row 1, 2 and 4:
1: 100 4 10 1
2: 120 2 12 1
3: 125 5 10 0
4: 105 3 15 1