Convert [Days, hh:mm:ss] to [hh:mm:ss] - excel

Some data i export to Excel appears like this: '3 Days, 2:15:37' (when the period exceeds 24 hours only, [hh:mm:ss] otherwise, which is ok).
How can i display it on Excel as [hh:mm:ss] even when it exceeds 24 hours?

Maybe you'll find a better method, but here's one method that involves using some helper columns. Since your column is of General format, then it's going to recognize some of your cells as Time except for those with "Days". You have a mixture of formats so it's a but cumbersome.
You can probably consolidate a couple steps here, but breaking it out better identifies a process. Column A is your original data.
Column B: Formula to extract data to the right of "comma space":
=IFERROR(MID(A2,FIND(",",A2)+2,10),A2)
Column C: For cells containing the word "Day", take the value to the left of it and multiply by 24.
=IFERROR(LEFT(A2,FIND("Day",A2)-1)*24,0)
Column D: Extract the HOURS from your time format of column B.
=HOUR(B2)
Column E: Take the MM:SS from column B.
=TEXT(B2,"mm:ss")
Column F: Put it all together:
=CONCAT(C2+D2,":",E2)
Here's one way to combine the last two steps, which would reduce the number of helper columns by one.
=CONCAT(C2+D2,":",TEXT(B2,"mm:ss"))

Related

Excel Data Entry made faster with Macro?

I am currently trying write a macro in excel to help shorten the time that this will take. I have water sample data for 10 different manholes and each were sampled quarterly since 1994. Because of this, I have a total of 75 dates that I need to input per manhole for this spreadsheet. Each of these dates has 97 rows of information that is input into this sheet and then a space before going to the next date. My ultimate question is, how can I take the dates shown from the first image and copy the first one 97 times, then second 97 times without redundantly doing so. Example is the image attached.
In column A have an integer sequence, starting at 0 and going up. In column B, do integer division on column A (QUOTIENT). You'll integer divide by the number of times you want things repeated (97). Then in column C, use VLOOKUP, taking the value from column B as the index into your lookup table, to "copy" the values for dates.
If you have the same measurements for each date, you can use a new column that uses MOD on column A, then use that as the index for a second VLOOKUP into your measurements lookup table.

Comparing dates in two columns with matching criteria

I'm trying to fill out a sheet with a somewhat complicated criteria, I have four columns I'm interested in, however the columns are mixed into a much larger table, sorry vlookup :(
There are two columns that contain an ID# and a Category, one column with date and time stamp, and one that MAY contain a date and time stamp. (Column1,2,3,4 respectively)
Column 3 is when an action took place, Column 4 is the next time that action with the same ID# and Category has to have been completed by.
Essentially I need a cell(s) that will check for a date in Column 4, if there is one, find the next value in Column 3 that is greater than that of column 3 in the row with the value in Column 4, AND has the same ID, AND Category and compare them to see if it was done on time, preferably also by how much if it was late.
I'm able to find it almost with:
{=MAX(IF([#[Column 2]]=[Column 2],[Column 4]))}
Entered as an array formula, however that will only give me the last time that Category was given a "Next Due Date" and similarly with Column 1 replaced for Column 2 in the code sample above, I only get the last time that ID# was given a "Next Due Date".
As some Event ID# can be around for many days, and can run concurrently with others there's no guarantee all IDs will be grouped, nor Categories within those IDs.
It appears any attempts to add an AND(.. function break the array, though I'm not positive I'm not just messing up the placement of it.
It's perfectly fine if the solution involves creating helper cells.
The table is sorted chronologically by column 3 with the latest date at the top if that's any help.
TYVM for even taking the time to read this :)
Edit 1:
Sample Data
I've included an image with some sample data, to clarify the awkward sentence above. The orange arrows are pointing to two dates that would be compared and the event was late. the Green points to a group that was on time.
the categories are
Those two are being compared because each set has the same category, and ID. I hope that clears it up :)
You could try this formula (goes into column E):
=IFERROR( IF($D2<>"", LOOKUP(2,1/($F1:$F$2=$F2),$C1:$C$2), ""), "")
Very important here are the $ signs, as the searched area is supposed to move with the row. (Note: this formula goes into E2. You then copy > pastespecial (only Formulas) it into the rest of the column.)
My table looks like this:
A B C D E F
ID Category Start-date Due-Date Completion-Date ID+Cat. (Helper column)
The formula in F is simply =$A2 & $B2. The data starts in Row 2.
You will need to replace the columns with yours.
Please let me know if this is what you were looking for.

Excel duplicate date subtraction

I have a table in Excel, with names in Column A, and dates in Column B. Names are present several times for the most part, each carrying a payment date in Column B. So if someone received one payment, the name is there once, with a date. If someone received eight, the name is there eight times, with eight different dates.
What I'm looking for is a method, to take each name (not the occurrence, but the same string), and present the difference of the maximum and the minimum date for every string that is the same (i.e. the date range of payments for every single person).
I tried basically everything in Excel. Conditional formatting and Pivot Tables did not help (the latter can only add, not subtract when using PT). Manual work would take a lot of time even if specifying min and max values for the entries, since the table has 17033 rows with 2218 unique names.
I would be grateful if you could help. I suspect the solution is not that hard, but I cannot really get my head around it.
You can use a standard array formula to list the distinct names e.g. in D2:-
=INDEX($A$2:$A$10000,MATCH(1,(COUNTIF($A$1:$D1,$A$2:$A$10000)=0)*($A$2:$A$10000<>""),0))
Then another one to find the maximum for each name and subtract the minimum:-
=MAX(IF($A$2:B$10000=$D2,$B$2:$B$10000))-MIN(IF($A$2:A$10000=$D2,$B$2:$B$10000))
But these are slow with ~10000 rows - a pivot table is much faster.
I would keep things really simple by putting the minimum and maximum date as value fields in the pivot table and manually adding a formula to subtract one from the other - will post a screenshot later.

Countif with dynamic headers

Good afternoon! I'm trying to get a Countifs or Index Match statement to count the number of times a value occurs in another table. The example:
On my report sheet, Column A contains 10 different statuses, such as Green, Yellow, Red etc.; Row 1 contains six dates, such as 1/31/2015, 2/28/2015, etc. These dates are calculations. The last date references my date worksheet and the five other use EOMONTH to get the month end for the five prior months.
On my data table, I have 7 descriptive columns (such as Type, Make, Model, etc) and then we begin date columns: 1/31/2010 all the way to 7/31/2015. I add a new column each month (I know, I don't like it either, but unfortunately we don't have a time series database).
What I need to do is have a Countifs or Index Match that pulls the date from my report tab, goes and finds it in the header row of my tblTrends, and then counts all those statuses that are Green, and if it's a SUV (for example).
Thoughts?
Thx!!
G
At it's most basic, you'd want something akin to:
=COUNTIFS(TypeRange,"SUV",FirstMonth,Status)
So let's say your data table starts in column L, and the first date column is O:
=COUNTIFS($L$1:$L$100,"SUV",O$1:O$100,A$2)
As you drag this formula across the different dates, it will move the date reference over one to the next month.
If you need it to dynamically determine the date column, I'd recommend OFFSET, which dynamically select a range. However, note that OFFSET is a "volatile" formula, which means it re-calculates anytime a change is made anywhere in the file, which can lead to pretty slow load times if not used sparingly.
=COUNTIFS($L$2:$L$100,"SUV",OFFSET($N$2:$N$100,,MATCH(B$1,$O$1:$Z$1,0)),$A2)
The OFFSET starts on column N, because that's the first column before the columns we want (the date columns). The MATCH tells it how many columns to OFFSET from here.
If you're going to use this over a large amount of data, then you could avoid using the OFFSET formula by creating a dynamic table. This table would only contain data for the six months you're interested in, by utilizing INDEX/MATCH, and you could run your COUNTIFS off this table, instead, using the original, basic method I first described. I can go into detail if you're unsure what I mean.

How to convert 1min OHLC data into 5min OHLC data

I'm trying to convert 1 minute OHLC (Open/High/Low/Close) data into 5 minute OHLC data in Excel 2013. So far I know the principle. Open has to take the open value every 5 rows, similarly for Close. Min/Max is also understandable. Unfortunately Excel can't understand that I want to get Min/Max from rows 0-5, 5-10 etc. it goes 0-5, 1-6, 2-7 etc.
I was also trying to use AVERAGE somehow but it's pointless since its output doesn't correspond with reality at all. From some more research I think I will have to create a macro from functions AVERAGE, OFFSET, INDEX and MATCH and that's where my struggle begins. I have no idea how to construct that formula.
Here's a picture of how it looks after using Filter on the Count Column:
Add a column (assumed to be A) on the left with 0 as a label and =IF(MOD(B2,6)=0,1+A1,A1) in A2 copied down. Subtotal for each change in 0 and use Count on all the other columns. Change the first subtotal row formulae to be:
ColumnC: =C2
ColumnD: =SUBTOTAL(4,D2:D6)
ColumnE: =SUBTOTAL(5,E2:E6)
ColumnF: =F6
Filter for ColumnA contains c and copy formulae down.
Edit
pandas library of Python would do it easily. Give it a try

Resources