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
Related
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.
In Column A I have numbers from 1 to 30 and in Column B I want to add 10 to the number in column A i.e.
if A1 is 1 I want 11 in B1 and in C1 I want 21 and
if A2 is 2 I want 12 in B2 and in C2 I want 22.
I don't want the numbers in columns B and C to exceed the maximum limit of numbers I have in Column A, in this case that is 30.
I need a formula to achieve this so that none of the cells in column B and C has the number exceeding 30 and if the addition exceeds that I want 30 to be subtracted from it. I tried this with IF but it didn't help as I don't know how to manipulate the current cell after adding the number.
Screenshot of expected results:
I want the number in B Column to be addition of 10 to the number in A Column and it should not exceed maximum number.
Maybe, in B1:
=A1+10-30*(A1+10>30)
and in C1, both copied down to suit:
=B1+10-30*(B1+10>30)
Considering B1, the above can be simplified slightly by rendering (A1+10>30) down to (A1>20).
A1+10 is the basic requirement.
The condition is that where A1+10 exceeds 30, a deduction of 30 should be applied. This can be restated as "where A1 exceeds 20".
(A1>20) returns either TRUE (when A1 is more than 20) and FALSE (otherwise).
What may not have been appreciated by all is that when used as a multiplier, Excel treats TRUE as 1 and FALSE as 0.
So when A1 is less than or equal to 20, nothing is deducted from to A1+10. 30*(A1>20) becomes 30*FALSE (effectively 30*0), which is 0. However, when A1 is more than 20 30*(A1>20) becomes 30*TRUE (effectively 30*1), which is 30.
The formula for B1 is:
=IF(A1+10>MAX($A$1:$A$30),A1+10-MAX($A$1:$A$30),A1+10)
(For C1 just do "Fill Right" from B1.)
Sometimes it's better to use several columns to get to the result:
First I created in D1 =A1+10, then in E1 =MAX($A$1:$A$30).
The $ means that the column or row number does not change when you fill down, so A1 stays fixed to A1 in every cell.
In F1 I created an IF formula: =IF(D1>$E$1,D1-$E$1,D1) which means "IF D1 exceeds the highest value in A1 to A30 THEN subtract that highest value from D1 ELSE just display D1 (=A1+10)"
And if you substitute these values:
(E1): =IF(D1>MAX($A$1:$A$30),D1-MAX($A$1:$A$30),D1)
(D1): =IF(A1+10>MAX($A$1:$A$30),A1+10-MAX($A$1:$A$30),A1+10)
you get the result I mentioned in the first place.
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.
I am currently using the following formula i.e. =IF(COUNTIF($A$1:A2,A2)>4,A2+1,A2) to change the number when I drag this formula downsdie of the rows.
For Example: in this case for every five rows number will change i.e. A1 to A5 it will 1 and A6 to A10 it will be 2 and A11 to A15 it will be 3 etc.
Just wanted to know is it possible to extend the same formula, so along with adding 1 number for every five rows it should also skip 2 numbers for every 60 rows.
For Example: if the 60 row is number 12, then 61st row should be 15 and 120 row will be 26 and 121 row should be 124 etc.
Can someone please help me with this formula?
Thanks for your help in advance.
Number starts at one.
Then get the cell's row number and subtract one. Divide that number by 5 and discard the fractional part (or the remainder). So numbers from 0 to 4 (which are rows 1 through 5) all get an increment of 0, 5 to 9 get 1, and so on. Similar logic with multiples of 60 except that the counting is doubled.
=1 + floor((row()-1)/5, 1) + floor((row()-1)/60, 1) * 2
I'm average at Excel and this one has me stumped.
What im trying to do is calculate if a cell is 0 return a figure of 0, if the cell is greater than 0 but less than 61 (eg 60) return .15, if the cell is greater than 61 then divide the cell by 60 and round up to the next whole number eg if the cell is 86 the figure returned from the divide is 1.433 so i want that rounded to 2.
Any help would be great
Thanks
Here's your formula. Assumes your cell containing the value to be evaluated is A2
=IF(ISNUMBER(A2),IF(VALUE(A2)<=0,0,IF(VALUE(A2)<=61,0.15,ROUNDUP(VALUE(A2)/60,0)*0.15)),"0")
Here are the test results for all your conditions.
Maybe:
=IF(AND(ISNUMBER(A1),A1>0),IF(ROUNDUP(A1/60,)<2,0.15,0.15*ROUNDUP(A1/60,)),0)