I want to generate values based on a condition statement:
If A1 is less than or equal to 500, then add 100
if A1 is less than 1000 and greater than 500 then add 200
if A1 is greater than or equal to 1000 then add 300
and so on.
How might I achieve this in Excel?
You can start with following formula and improvise. Not complete
=IF(F6<=500,F6+100,IF(F6<=1000,F6+200,"do more"))
Here F6 is cell in worksheet.
Read IF method help for more details.
Given "and so on", perhaps:
=A1+100*(1-(A1=500))+(INT(A1)-MOD(A1,500))/5
Related
I am trying to create a formula that finds the monthly mileage for a vehicle. The simple =max(array)-min(array) will not work because there are blanks/0 cell values due to a vehicle not being driven. This causes the minimum to be zero. I have tried to use the small(array,2) but if there are multiple cells, it counts every blank as a separate value. Is there a simple way to express this? All cells are pulling the mileage from a separate workbook so even the blank cells have a formula. I want to write a formula for the following expression, "the cell with the maximum mileage minus the cell with the minimum mileage but the minimum cell can not be zero or blank, if it is skip/do not use".
I know the maximum for the first box is 40532 - minimum is 40285= 247
The maximum for the second box is 13281 - minimum is 13154= 127
You can use MAXIFS()for this: it calculates a maximum, in case of criteria.
MAXIFS() is described in this URL.
Edit for more explanation
I've just created the following worksheet:
A B C
1: 100 200 300
2: 0 100 300
3: 400 50 200
4: 0 100 100
I have entered this formula:
=MINIFS(A1:C4;A1:C4;">0")
The first A1:C4 is the range, where the minimum should be calculated.
The second A1:C4 is the range, where the criterion should be validated.
">0" is the criterion itself.
The result was 50, as it should be.
I have this statement in Excel (Nested IF)
=IF(E3-B3>0,E3-B3,IF(D3-B3>0,(D3-B3),IF(C3-B3>0,C3-B3," ")))
What I am missing is that he 250 value on the last Cell H3 (Dollars to Budget MTD) have to be calculated only (E3-B3)30-50 and returning -20 as a result. However, it is returning 250 which is wrong in my logic.
The 250 value on the last Cell H3 (Dollars to Budget MTD
) have to be calculated only 30 -50 = -20
It seems you want the last number in C3:G3 as the minuend, B3 as the subtrahend and the difference in H3. Try this in H3,
=index(B3:G3, match(1e99, B3:G3))-B3
'... for a running total then,
=sum(C3:G3)-B3
As soon as you fill in F3, either of the formulas will adjust.
Try this:-
I simply used a dummy value A in your formula which will never be true
=IF(E3-B3<>"A",E3-B3,IF(D3-B3<>"A",(D3-B3),IF(C3-B3<>"A",C3-B3," ")))
I'm struggling with the following:
I have price ranges from
100 - 200
201 - 300
301 - 400
401 - 500
501 - 600
In every range I give a number from 1-5. I'm trying to give a a number from 1 to 5 to a cell that will check in which price range is.
For example if I write in price field 150 it has to give me to the cell with the formula the number 1 according to the ranges I have. So far I've tried the following but I cannot nest more than 3 ifs.
=IF(AND(B9>=A10,B9<=C10),"1",(IF(AND(B9>=A11,B9<=C11),"2",IF(B9>=A12,B9<=C12,"3"))))
You could use =SUMPRODUCT() to do this. There are also some CSE formulas that would do the trick, but I prefer non-CSE since those can be finicky if someone messes with the formula and doesn't enter them properly:
=SUMPRODUCT((B9>=$A$10:$A$19)*(B9<=B10:B19)*(ROW($A$10:$A$19)-9))
Sumproduct will test each condition here that is then being multiplied together. The conditions in this formula are: (B9>=$A$10:$A$19) and (B9<=B10:B19) which are pretty self explanatory. From each condition, for each row in the range it gets a 1 or 0 (TRUE or FALSE) and then multiplies that by the ROW()-9 for each row being tested. In the end you get the ROW()-9 for whichever row has two TRUE conditions, or 1 * 1 * (Row()-9).
Note that because it tests each row, only one row should return two true conditions, otherwise you'll add up row numbers and get bad results.
Set up a cross-reference table of the minimum amounts for each price range in ascending order. From your sample data this could be Z2:Z7.
Your formula to examine the value entered into B9 would be,
=IFERROR(IF(B9<MAX($Z$2:$Z$7), MATCH(B9, $Z$2:$Z$7), NA()), "not in range")
If everything equal-to-and-above 501 should be in price group 5 then simply remove the top values (e.g. 601) and the check for the maximum.
=IFERROR(MATCH(B9, $Z$2:$Z$6), "not in range")
That will still return not in range for values less than 100 but anything over 500 will return price group 5.
I can't come up with the right formula for this.
Cell B3 contains a value. In cell C3 is the formula which should calculate: if B3 exceeds 1500, i want it to display the difference.
E.g. IF value of B3 is 1600, C3 should display 100.
Thanks, can't get my head around it.
If you want it to show the value of B3 when that value is less than or equal to 1500, and to show the difference if it is greater, use the following:
=IF(B3>1500,B3-1500,B3)
If you want it to show nothing if it is less than or equal to 1500, use:
=IF(B3>1500,B3-1500,"")
=if(B3>1600;B3-A3;"")
Honestly i didn't catch the other operand of the difference you describe, but that is the If formula..
hope it helps..
=IF(B3>1500;B3-A3;"")
As you mentioned if value is greater than 1500 so the formula should be as above.
I have the following data:
net profit cum. profit
10 10
20 30
20 50
20 70
20 90
cum.profit(current cell) =net profit (in the same row) + cum. profit (previous cell).
Now ıf my cum. profit exceeds 100 I wish the current cum. profit cell to display the "value" as well as a text like" you have exceeded 100". I use:
=IF(I55+H56<100,I55+H56,"STOP")
so, if I55+H56 is less than 100 the cell is filled value I55+H56, else the text value "STOP" is written into the cell. But I want the value also to be written into that cell. i.e something like 100,STOP.
How can I do this?
Try this
IF(I55+H56<100,I55+H56,(I55+H56)&",STOP")
If you want the value in the cell to remain a number (i.e. to allow calculations on the row) you can use a custom format.
just use this in your cell: =I55+H56
Right click and select "Format cells".
Then go to Custom format and type: [>=100]0", Stop";0
The result will be 120, Stop for a value equal to 120.