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

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.

Related

Find row when Cumulative sum reaches certain value with condition

I have a table with 3 columns Date, Item and Number. Each row indicates how many items of each Item was received on that date. I am trying to find the date on which cumulative sum reaches 100 or more in that month. Each month will have a target for each item which will be saved in another sheet but for simplicity we can assume that its a fixed number of 100.
Example Data:
Date Item Number
1/2/2018 A 10
2/2/2018 B 10
2/2/2018 A 15
5/2/2018 C 25
6/2/2018 A 50
7/2/2018 B 10
7/2/2018 C 10
8/2/2018 A 25
9/2/2018 A 20
I am looking for the formula which should act on the data similar to above and give the result as 8/2/2018 which is the date on which the cumulative sum for Item A reached 100.
Each month will have different target number, and will have different number of entries.
I have tried using SUMIF and adding a additional column etc but this data is just part of a big data and each item limit is saved in a different sheet etc which is not easy to merge. Thanks in advance for help.
In Excel only, you can use Offset to develop an array of items and numbers containing 1,2,3...9 rows and then SUMIF to add each of them up. Then use Match to find the first one =100 and Index to find the matching date (in F2):
=INDEX(A2:A10,MATCH(100,SUMIF(OFFSET(B2,0,0,TRANSPOSE(ROW(A2:A10))-ROW(A1)),"A",OFFSET(C2,0,0,TRANSPOSE(ROW(A2:A10))-ROW(A1))),0))
Must be entered as an array formula using CtrlShiftEnter.
EDIT
To find the first sum which is >=100 (in G2):
=INDEX(A2:A10,MATCH(TRUE,SUMIF(OFFSET(B2,0,0,TRANSPOSE(ROW(A2:A10))-ROW(A1)),"A",OFFSET(C2,0,0,TRANSPOSE(ROW(A2:A10))-ROW(A1)))>=100,0))
Sum which reaches exactly 100
Sum which does not reach exactly 100 (the number in row 9 has been changed to 24):

Excel - function to find the highest sum in a table using each row and column only once

I've got a table in excel with 10 rows and 10 columns.
The table contains 100 different values between 1 and 3.
I want to find the highest sum of 10 values using only 1 value from each row and 1 from each column.
Do u guys know a function that finds the highest sum? - I've tried to do i manually, but there are to many combinations!
Hope it makes sense.
Thanks in advance:)
My solution builds on what I wrote in the comment, i.e. you first take the maximum value in the 10x10 array, then the maximum in the 9x9 array (excluding the row/column of the first maximum), etc. My solution tries not to do everything in one formula, but I add a few helper columns, and a bit more helper rows (it is fast and dirty, but it works and is easily audited/understandable). You always can do this on a separate worksheet which you could hide if needed.
The screenshot above goes from cell A1 till Y31.
The key formulas:
3.55 is the result of =MAX(B2:K11)
The first gray cell is =IFNA(MATCH($M12;B2:B11;0);""), and you drag this 9 cells to the left. This tries to find a match with the max result in each column of the table;
The 10 left of the 3.55 is =MATCH(TRUE;INDEX(ISNUMBER(P12:Y12);0);0) , and gives the column number of the max value.
The 2 next to the 10 is =INDEX(P12:Y12;N12) and gives the row number of the max value.
The 1 in cell B12 is =IF(OR(B$1=$N12;$A12=$O12);0;1), and creates a 10x10 matrix with a row and column with zeroes where the previous max value was found.
Then you multiply this with the preceding matrix and create a new 10x10 matrix below (enter {=B2:K11*B12:K21} array formula (ctrl+shift+enter) in B22-K31
You then copy/paste rows 12 till 31 9 times below
The 23.02 is the total sum =SUM($M$12:$M$211) from all 10 maximum values and is the result you are looking for. The 10 is just a check with =COUNT($M$12:$M$211)

EXCEL Max value for multple time/date intervals

I have an excel file as per the image attached
The date range in column D spans several days ie. there is also data for 10/08/2016; 10/09/2016, ect...
I am trying to get the maximum value in columnC for each 15 minute interval in column D.
eg:
10/08/2016 00:00 - 00:15 -- 0
10/08/2016 00:16 - 00:30 -- 25
10/08/2016 00:31 - 00:45 -- 13
and so forth until the end of the file.
Any help is appreciated.
First you need to get the 15 minute intervals. To do this, I put the Date/Time Start values in column F starting in F2 (I assumed row 1 is a header row). In cell F2 is this formula: =FLOOR(MIN(D:D),15/1440) and in cell F3 and copied down is this formula: =IF(F2="","",IF(F2+TIME(0,15,0)>MAX(D:D),"",F2+TIME(0,15,0)))
Then I put Date/Time End values in column G starting in G2 (because row 1 is a header row). In cell G2 and copied down is this formula: =IF(F2="","",F2+TIME(0,15,0))
Now you can get your maximum per interval. To do this, I put Max Interval Value results in column H starting in H2 using this formula copied down: =IF(F2="","",MAX(INDEX(($D$2:$D$11001>=F2)*($D$2:$D$11001<G2)*$C$2:$C$11001,)))
Adjust columns to suit your needs, and adjust the ranges ($D$2:$D$11001 and $C$2:$C$11001) to suit your actual data.

Frequency of data occurence in Excel Column based on the certain condition

I have a column (Table 1 below) with time data in 24 hour format saved as text.I want Table 2 to be populated by the hour and adding all the occurrences for the hour.
So one occurrence is at 0102. This falls within an hor range of 12:30am to 01:30pm. I want the count to be 1 for 01:00.
If an occurrence falls between 01:30 to 02:30 I want the count to be 1 for 02:00.
Also if time is 04:55 it should show count for 05:00 as 1. Basically rounding to the closest time and showing a count for that. It should round of to the nearest time and add the number of occurrences also. Thats why 06:00 is 2. to account for 0622 and 0614.
For example:
TABLE 1 TABLE2 (Expected results)
Column A Column A Column B
0102 01:00 1
0222 02:00 2
0223 03:00 0
0455 04:00 0
0622 05:00 1
0614 06:00 2
NOTE In B1 we get 1 because value in A1 of TABLE1 is 0102 and falls between 12:30 and 01:30, thus represented by 01:00 in A1 in TABLE 2. We have two values in Table1 between 01:30 and 02:30: one is in A2 and the second is in A3, so we expect 2 in B2 in TABLE 2, the time range which is represented by 02:00 in A2. We attribute 0 to cells B3 and B4 in Table2 because there isn't any data in Table1 between 02:30-03:30 and 03:30-04:30, therefore they get 0 in their corresponding cells in Table2. However, we have two instances of data, 0622 and 0612 in Table1 which fall between 05:30 and 06:30, so value 2 is attributed to B6.
How do I do this using a formula?
Please help.
So after struggling to understand what was going on, here is the simple solution:
first let me clarify again:
column A: but pasted as text originally and in hhmm format, but you need to reformat them as simple numbers, so you will lose those 0 s at the beginning of certain data.
column B: we put down our time ranges, as you said, starting from 12:30 AM, so i put it down as 0030 of which the zeros are not visible anymore in number format. This range starts from 30 and increments by 100, until it stops at 2330 instead of going to 2430. this will be reflected in the formula for the last cell in column D.
column C: the hour ranges against which we round and count the data in A.
column D: we put down the following formula in D2 :
=COUNTIFS(A:A,">"&$B2,A:A,"<"&$B3)
and drag and fill down until the last but one cell.
for the last cell D25 we change the greater/smaller than signs, and use the following formula (only for this cell):
=COUNTIFS(A:A,"<"&$B25,A:A,"<"&$B2)
Try these formulas, if it doesn't work, download the example sheet,
here is the example sheet i created for this purpose, downloadable from here
and if you still have questions, don't hesitate to put them in the commentaries.

Issues with VLOOKUP in Excel

I have a tax table in one sheet that has a list of tax values. For example:
Sheet1: Tax Tables
A B C
1 Min Max Taxed
-------------------
2 50 100 10
3 100 200 20
4 200 300 30
In another sheet I have a gross income value of say 120 in cell A1. What I want to do is have a vlookup (I'm assuming that's what I should use) that checks cell A1 to see if it's between the Min and Max and then outputs the taxed amount in B1.
Sheet2: Income
A B
1 Gross FedTax
-----------
2 120 Value from Column C goes here
I already have the sheet in Tax Tables set up with named spaces A:C=Min and B:C=Max
I tried doing this:
=AND(VLOOKUP(<A1,Min,3,False),VLOOKUP(>A1,Max,2,FALSE))
But not even close...
I just want to check column A in the first sheet to see if it's less than the the value in the second sheet, and check column B in the first sheet against the value in the second for if its more, then put the value in column C in the first sheet into the cell next to the value in the second sheet.
To use a VLOOKUP, put your maximums and minimums in the same column.
Then use the TRUE argument, which means it looks for the next value that matches. Assuming the value you're looking up in D2, you'd put a formula like this in E2:
=VLOOKUP(D2,$A$2:$B$5,2,TRUE)
First of all it is unclear what you would apply when the amount is exactly 50/100/200/300/... So i decided to include the lower limit in the interval and exclude the upper limit.
For this problem I would use a sumifs like this (you have to decide on which side to put the equal sign:
=SUMIFS(Sheet1!C:C;Sheet1!A:A;"<="&A1;Sheet1!B:B;">"&A1)
This would only take those elements in column C that have a value in column A smaller than or equal to 120 and a value in column B greater than 120

Resources