How to put a value and a text in an excel cell - excel

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.

Related

Mileage log Trouble

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 am trying to make a weekly projection using nested if in Excel

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," ")))

Conditional Average in Excel For 8 Most Recent Scores >0

I have 15 scores or more and I want to average the most recent 8 scores (based on date) that are greater than zero. Here is the example:
6/4/15,
6/18/15, 50
7/9/15, 46
7/16/15, 41
7/23/15, 47
7/30/15, 47
8/6/15,
8/13/15, 46
8/20/15, 49
8/27/15, 44
9/3/15,
5/5/16, 58
5/12/16, 53
5/19/16, 44
5/26/16, 42
Thanks for any help!
You can use this array formula:
=AVERAGE(IF(($A$1:$A$15>=LARGE(IF($B$1:$B$15<>"",$A$1:$A$15),8))*($B$1:$B$15<>""),$B$1:$B$15))
Being an array formula it needs to be entered with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {} around the formula.
We can make the formula a little more dynamic by using INDEX($B:$B,MATCH(1E+99,$A:$A)) to set the last row in the dataset.
Array formulas calculate exponentially, so we want to limit the size of the references to the actual size of the dataset.
What the formula does is it finds the last cell with a number/date in column A and uses that row as the last row.
So putting it all together:
=AVERAGE(IF(($A$1:INDEX($A:$A,MATCH(1E+99,$A:$A))>=LARGE(IF($B$1:INDEX($B:$B,MATCH(1E+99,$A:$A))<>"",$A$1:INDEX($A:$A,MATCH(1E+99,$A:$A))),8))*($B$1:INDEX($B:$B,MATCH(1E+99,$A:$A))<>""),$B$1:INDEX($B:$B,MATCH(1E+99,$A:$A))))
It is still an array formula so the above condition of using Ctrl-Shift-Enter is still needed.
As a disclaimer, I don't have any screen captures or actual formulae, but you did not show us very much.
First, sort your data in descending order by score (ALT + D + S). This will place all the zero entries at the bottom. You can now ignore them since you don't want them to be part of your averages.
Next, sort the data having a score greater than zero (i.e. not appearing at the very bottom) by date in descending order (ALT + D + S again on the date column).
Then just take the average of the first 8 rows after this sort using the AVERAGE() function.

If Value Less Than 500 Add 100, and so on

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

Finding MAX value for a certain month

I have a problem that shouldn't be a problem but I'm unable to solve it.
My data looks like this:
2012-04-05 1280
2012-04-17 1340
2012-04-20 1510
2012-05-03 1670
2012-05-09 1880
What I want to do is to find the MAX value for april and for may.
So MAX for april should return 1510 and MAX for may should return 1880. Can this be done?
EDIT:
Maybe simplified it a bit too much, here is an example closer to what I really want to do:
2012-04-04 14 220
2012-04-11 453 863
2012-04-19 900 1310
2012-05-02 1400 1810
2012-05-15 1900 2250
These are milage from my cars trip computer. I would like to calculate how far I drove each month.
For april: 1310-14 = 1296
For may: 2250-1400 = 850
A simple array formula can do this. If your dates are formatted as dates in Excel, paste the following into a cell and press Ctrl+Shift+Enter:
=MAX(IF(MONTH($A$1:$A$5)=4,B1:B5))
Can this be expanded to also allow 0 to be filtered out? When you use the MIN instead of MAX and your data range has empty values this results into 0 to be reported as the lowest value.
A simple array formula can do this. If your dates are formatted as dates in Excel, paste the following into a cell and press Ctrl+Shift+Enter:
=MAX(IF(MONTH($A$1:$A$5)=4,B1:B5))
If your dates are formatted as text, paste the following into a cell and press Ctrl+Shift+Enter:
=MAX(IF(MID($A$8:$A$12,6,2)="04",$B$8:$B$12))
if you just need the answer once, filter by month and run a max function.
You could use a pivot table. Below, Amount is summarized by Max. I right-clicked on the date column, chose Group By and then selected both Year and Month. The picture obviously shows the source data, pivot table and two dialogs. In practice you'd put the pivot table on its own worksheet:
You can use this simple formula to get max of the month in a given range.
where J2 - J7 is my date range, use Max to get maximum of the dates in that range and use text to get the month.
=TEXT(MAX(J2:J7),"mmm")

Resources