excel - how to calculate area in single drag - excel

LENGTH
BREADTH 10 20 30
10 100
20
30
Above is excel sheet data. 100 is calculate by a formula =(A4*B3) ie 10*10
I want to populate the answer in rest of the cells too.
Means I just want to write the formula once, which I did and got value 100, and now I just want to drag and apply the same formula to every block.
This is what I get when I drag the cell, which is wrong calculation:
LENGTH
BREADTH 10 20 30
10 100 2000 60000
20 2000 4000000 2.4E+11
30 60000 2.4E+11 5.76E+22

All you need to do is set part of your formula to be static like so:
=B$2*$A3
The $ prevents the value after it from changing when you drag or copy the formula, but the other value is free to change based on the cell reference.

Related

Sum the values of a cell in Excel or change to a different expression of that value in another cell

I have a cell of a worksheet with a value of
1h 25m
entered with the cell (got it from a Jira import). I am trying to figure out how to populate another cell on the same row with a purely numerical version of this cell value, i.e.
85
This is so that I can run SUMIF statements to get the total amounts of minutes for a given person, on a given day.
As in the provided image, I want the sum total amount of Log Work (Column C) for Matthew R. on the 17th of October.
Here, we're creating two helper columns. You could combine everything, but thought this may be easier to illustrate.
Value
hours
minutes
sum
5m
0
5
5
1h 35m
1
35
95
3h
3
0
180
4h 55m
4
55
295
12h
12
0
720
Column A (Value) is your original value.
Column B (hours) is the following formula, which finds the letter "h" and returns everything to the left of it. If H is not found then return a 0.
=IFERROR(LEFT(A2,FIND("h",A2)-1),0)
Column C (minutes) is the following formula, which returns everything to the right of "h" and then removes "m" and trims it. But if "m" is not found then return a 0.
=IF(ISNUMBER(SEARCH("m",A2)),TRIM(SUBSTITUTE(IFERROR(RIGHT(A2,LEN(A2)-FIND("h",A2)),A2),"m","")),0)
Lastly, column D simply calculates total minutes as:
=(B2*60)+C2
You can probably shorten column C's formula, but this at least provides you an interim solution.

How can i calculate instances based on time

what will be the formula to show results based on cell value. For example when i enter 30 in cell results will be 1, for 60 results will be 2 and so on. But if entered value will be less then multiple of 30 then result will show divisible of 30 for example if i enter 45 then result should be 1 and for less than 60 but greater than 30 then result should be 1.
use formula =INT(D2/30) where D2 is cell in which you have entered the value

Make formula for list of row names independent from entire column and first row

I have the following Excel spreadsheet:
A B C D E F G H
1 Q1 Q2 Q3 Q4 Search criteria: 60 Asset 2
2 Asset 1 15 85 90 70 Asset 3
3 Asset 2 40 80 45 60 Asset 3
4 Asset 3 30 60 55 60 Asset 5
5 Asset 4 12 72 25 15
6 Asset 5 60 48 27 98
7
In Cells A1:E6 I have different assets with their performance from quarter Q1-Q4.
In Column H I list all assets that match the search criteria in Cell G1.
In this case the search criteria is 60 which can be found in the Cells A1:E6 for the Assets 2, 3 and 5.
For creating the list I use the formula from here:
=INDEX(A:A,SMALL(IF($B$2:$E$6=$G$1,ROW($B$2:$E$6)),ROW(1:1)))
All this works fine so far.
Now when I move the Cells A1:E6 in the sheet for example to D9:H14 the array formula keeps only working if it still refers to A:A and ROW(1:1) which might be a problem if the user decides to delete ROW(1:1). Therefore, I tried to modify the formula to:
=INDEX($D$9:$D$14,SMALL(IF($E$10:$H$14=$J$10,ROW($E$10:$H$14)),ROW($D$9:$H$9)))
However, with this modification I get #NUM! error.
Do you have any idea if it is possible to make the array formula independent from A:A and ROW(1:1) so it refers only to the Cells A1:E6 and automatically moves when the those cells are moved?
If you use excel 2013 or later then you can use following formula.
=IFERROR(INDEX($D$10:$D$14,AGGREGATE(15,6,ROW($1:$5)/($E$10:$H$14=$J$10),ROW(1:1))),"")
You can limit A:A to A1:A6 so that it would adjust as necessary when you move it. Your formula should thus be now
=INDEX(A1:A6,SMALL(IF($B$2:$E$6=$G$1,ROW($B$2:$E$6)),ROW(1:1)))
As for ROW(1:1), your top formula should always be ROW(1:1) and when you drag it down, then next formula should have ROW(2:2). When you move your top formula somewhere else and the ROW(1:1) changes to something like ROW(9:9) or anything, change it to ROW(1:1).
Please note that 'moving' your formula is different from 'dragging it down'.
EDIT:
So after you moved your data set, the top formula should now be:
=INDEX($D$9:$D$14,SMALL(IF($E$10:$H$14=$J$10,ROW($E$10:$H$14)),ROW(1:1)))
This is assuming that cell G1 (criteria) is also moved to J10.

Increase value of cells until a threshold, then display remainder and thereafter text

I have a row that begins with 50. As the row progresses from left to right, I want to increase this value by 50%. I have a threshold that is set at 200. The value cannot increase beyond this, but must show the remainder before it passes the threshold. After this, it should display the text "MAX".
To give a bit of context, I have a population of 200 people. Of this group, 50 contract a disease, which spreads throughout the population at a rate of increase of 50% of the currently infected population. Obviously you cannot infect more than 200 people as this is the threshold, and so the last cell before the first "MAX" should show the remaining number of people left to be infected, then all subsequent cells should show "MAX". e.g.
50,75,113,169,31,MAX,MAX,MAX,MAX etc
Where 31 is the remaining population to be infected (200-169) and 50+75+113+169+31 = 200. Is this possible?
Put A1 = 200, A2 = 50, put this formula to B2 and extend to C2, D2....
=IF(AND(A2>=$A$2, ISNUMBER(A2)),IF((1+0.5)*A2<$A$1,(1+0.5)*A2,$A$1-A2),"max")
Got exactly what you need
50 75 113 169 31 max max max max
Put 50 in cell A1. Then put this formula in cell B1 and fill right:
=IF(SUM($A$1:A1)=200,"MAX",IF(SUM($A$1:A1)+A1*1.5>200,200-SUM($A$1:A1),A1*1.5))
due to rounding I get a slightly different output with this:
=IF(OR(A1<INDEX(1:1,MAX(COLUMN()-2,1)),A1="Max"),"Max",ROUND(IF(A1*1.5>200,200-A1,A1*1.5),0))
Put 50 in A1 and this formula in B1 and copy over.

How do I calculate average in Excel between an undefined set of cells?

I have a table that looks like this:
User Interval
270 new user
270 30
270 18
270 7
295 new user
295 50
295 30
310 new user
310 40
317 new user
For each user, I'd like to know the average and the max interval. My problem is that I don't know how to calculate an average that will run only between 2 values of new user, and the amount of intervals per user is not set. Is there a way to do it in Excel?
Thanks!
As codenut says you can use AVERAGEIF for an average (If you have Excel 2007 or a later version) but there is no "MAXIF" function so you need an "array formula" for that.
Assuming data in columns A and B try this formula in C2
=IF(B2="New user",AVERAGE(IF(A2:A$1000=A2,B2:B$1000)),"")
once you have pasted that in C2 you need to press F2 to select formula then hold down CTRL and SHIFT keys and press ENTER. That will put curly braces like { and } around the formula in the formula bar - now copy formula down column.
Repeat for D2 with exactly the same formula except replace AVERAGE with MAX
You will get the max and average for each user at the top of each with other lines blank
This works for up to 1000 rows - change formula as required if you have more data.
perhaps the averageif function can help you out? http://office.microsoft.com/en-us/excel-help/averageif-function-HA010047433.aspx

Resources