I Need to Average mm:ss.000 - excel-2007

I have a data of time results that I need to average but I cannot get around it in Excel 2007.
Here is a sample of the data:
1:08.225
1:08.281
1:13.285
1:13.291
1:13.614
1:13.658
1:15.175
1:15.906
1:20.656
1:27.239
1:31.923
1:50.859
1=minutes, 08=seconds and 225=milliseconds.

I pasted your data into cells A1:A12 in Excel 2007 and entered the formula =AVERAGE(A1:A12) into A13. Next if you apply the custom number format mm:ss.000 you will see the thousandths of milliseconds.

Use the Average function on these values and assign the cell the format mm:ss.000 (Excel does the required conversions)

Related

How to use variable cell value in api query

I am a newbie with VBA and would like to perfect the last step in a complex spreadsheet. I hope someone can help me.
I need to convert EUR to USD based on historical dates which are to be found in adjacent cells and I need to do this for an entire column.
My query works fine with a fixed date inserted, no variable. How can I run this type of query with VBA for each row while inserting the appropriate variable date?
I have column B with date, column R with a modified date and column S with EUR value.
My target cell would be something like the below formula, where I have inserted in brackets where I need the variables applied to the search query. (dates).
Basically: If B5 is empty- do nothing, if R5(modified date) is empty- use B5 date for search, or else use R5 date for search
=IF( B5="", "", IF(R5="",[QUERY DATE VALUE IS B5] S5*XCH!B2, [QUERY DATE VALUE IS R5] B5*XCH!B2))
Sorry if I am not very technical here, thus I'm including all the info I have.
My working query (not VBA) is set up like this: (Note Date in query)
APPLIED STEPS:
Source: = Web.Page(Web.Contents("https://www.x-rates.com/historical/?from=EUR&amount=1&date=2018-07-01"))
Navigation: = Source{0}[Data]
Changed Type: = Table.TransformColumnTypes(Data,{{"Euro", type text}, {"1.00 EUR", type number}, {"inv. 1.00 EUR", type number}})
Removed Bottom Rows: = Table.RemoveLastN(#"Changed Type",8)
For example, in my target cell, the simple formula below works by using the fixed date inserted into the query (not the appropriate date).
=IF( B5="", "", IF(R5="", S5*XCH!B2, S5*XCH!B2))
Now, how do I get the above results for each cell BUT based on the values in R5 and S5 respectively?
Is this even possible to run VBA for each single cell in a column? All data is currently imported via a Macro from another worksheet. No user input.
So I would either use a macro- button to update all values on click, or use VBA to update the EUR value the moment data is imported.
I greatly appreciate any help I can get.

VBA Drag down Vlookup

All,
I have a data sheet of around 1.000 values which need a matching amount (the amount of valueschanges every day) . These amounts can be found in another tab "Data".
so using a Vlookup code in VBA should help me. The code I'm using is:
Sheets("Data").Range("E2") = Application.WorksheetFunction.VLookup(Sheets("Data").Range("D2"), Sheets("Blocked").Range("C:D"), 2, False)
Result should appear in column E responding with the row of the lookup_value which can be found in column D.The table and column index don't change being Sheets("Blocked").Range("C:D")and 2
This code gives me the result I wanted but as I tried to drag down the formula with this function:
Range("E2").AutoFill Destination:=Range("E2:E440")
How can I drag down this formula without needing to create a seperate vlookup for each row?
You should use the Formula as an R1C1 reference and then u will be able to drag down
Sheets("Data").Range("E2").FormulaR1C1 = "=VLookup('Data'!R[-1]C,'Blocked'!C[-2]:C[-1],2,0)"

Excel Formula to calculate number of user hits in a system everyday

This is the continuation of my previous questions and I have included my global aim with project.
Excel Link:
https://drive.google.com/file/d/0B5W4CgZKsARFSmhqV0ZSM1lBSkE/view?usp=sharing
Task:
The task is to collect the "number hits" of a user in an application "on each day". I can collect a log from the system which will give me the name of the users and their last hit date and total number of hits.(This total number of hits in not on daily basis, but sum of all days). and I need to make a formula to segregate these on daily basis
Screenshot:
To understand in better way I have created few screenshot, which I am looking to implement.
The excel has two tabs raw_data and value_capture. I will use raw_data to paste my raw data collecting from system log and value_capture to generate day by day hit statistics
Raw_data tab:
It has three details, 1. date. 2. name and 3 totals hits(This total hits are overall hits of that user on all days)
value_capture:
This has all user names and all dates to mark each day and a column to display all hits.
Now, considering an example of date 20141120, all users hits are 0.
raw_data shows 0 against all users
so value_capture are has to be updated with same
Now on next day 20141121, there is some hits against some users. (Note : if there is no hit against a user, it will only the previous date ie,date will update only if there is a hit on that day)
value_capture updated with that details
On 20141122, there are some more hits against the users
value_capture updated with the details. since the raw_data will show total number of hits against a user, the way of calculating on a particular will be total hits- previous date hit
I am stuck at a way to develop the excel formula here.Looking for an idea to implement this.
Note :
Users name will be fixed on both tabs, but that may come in different order in raw_data tab.
UPDATE
My raw_data sheet will be updated everyday and I want my formula results be fixed in the value_capture sheet after the values are updated (removed) from sheet raw_data
So as i mentioned in my answer to your previous question, the only way to save the results of a formula after deleting/removing its reference cells, is to use a macro.
First of all
you need a proper formula to pull the data from the raw_data sheet and then calculate the difference between that particular cell where the formula resides and the sum of previous cells in that row.
we need two formulas:one for the column B of your value_capture sheet. and the second one for the rest of your table. why? because in the first column you don't calculate the difference between itself and the previous cells, because there aren't any. So there is a little difference in the formula.
FORMULA ONE:(paste in B3 and drag and fill down)
=SUMIFS(raw_data!$C:$C;raw_data!$B:$B;$A3;raw_data!$A:$A;B$2)
FORMULA TWO:(paste in C3 and drag and fill down and to the right)
=IF(SUMIFS(raw_data!$C:$C;raw_data!$B:$B;$A3;raw_data!$A:$A;C$2)-IF(ISNUMBER(B3);SUM($B3:B3);0)>0;SUMIFS(raw_data!$C:$C;raw_data!$B:$B;$A3;raw_data!$A:$A;C$2)-IF(ISNUMBER(B3);SUM($B3:B3);0);0)
As you see in my screenshot for user in cell A3, we have value of 4 for the date 20141120 and the next day the value is 14 but the cell gets the difference, that is 10, and then then next day, the value increases to 16, so the cell value for D3 becomes 2 which is the different of 16 for that day and the sum of previous ones. This continues until today's value which is 24 so the cell gets 7 because the sum of previous ones is 17.
Now that you have your values captured correctly, with respect to the difference with the sum of previous days, it is time to make them fixed and eternal.
For this you need a macro:
Sub saveMyData()
Dim ws As Worksheet
Set ws = ActiveSheet
ws.Range("B3:L18").Copy
ws.Range("B3").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub
So obviously you need to update this range "B3:L18" this is what I have in the example sheet only.
Now this macro, copies and pastes all the values from that range onto itself, so you lose your formulas.So each day, you need to go to *line 21** of the same sheet and get the formula from C21 and paste it on somewhere on row 3 from where you want to continue capturing the new day's data. (you won't need the first formula, because it is only used once in the first column, the first day.)
This was the only way to capture the values using formulas and then save the results of the formulas in their place and go and fetch new data. I couldn't think of any other strategy to make it more automatic, except for writing mova VBA and letting excel go and find where you left the day before and paste the formulas in their right place and repeat the task.
all these formulas are array formulas, so press ctrl+shift+enter to calculate the formulas.
Remember to adjust the formulas to your regional settings, i suppose, by replacing the ";" with ",".
here is the example sheet downloadable from this link
Tell me if you have problems anywhere and don't forget to answer my question in the comments about the way you update your dates in row 2 of value_capture.
The formula that you are looking for is SUMIFS
=SUMIFS([SUM RANGE],[RANGE 1],[VALUE 1],[RANGE 2],[VALUE 2])
SUM RANGE is the column of values that you want to SUM so that is your column C. For Range 1 you want to select the range of IDs. The VALUE 1 will be equal to the value in Column A Row X. For RANGE 2 it will be the Date column. For VALUE 2 it will be the value in the column header.
Put this together and you have something akin to:
=SUMIFS(raw_data!$C:$C,raw_data!$B:$B,$A3,raw_data!$A:$A,B$2)
This would be in cell B3 and you could fill the other cells from there.
If total hits for a day is a rolling count of ALL hits ever then at the end of your equation you need to subtract the sum of the prior days.
For example:
=SUM(B3:B4)
This would only need to be added to subsequent columns (not the first).
So the equation in C3 would be
=SUMIFS(raw_data!$C:$C,raw_data!$B:$B,$A3,raw_data!$A:$A,C$2)-SUM(B$3:C3)
Then in D3 it becomes
=SUMIFS(raw_data!$C:$C,raw_data!$B:$B,$A3,raw_data!$A:$A,D$2)-SUM(B$3:D3)
Try Sumifs formula
=SUMIFS(raw_data!$C:$C,raw_data!$B:$B,$A3,raw_data!$A:$A,B$2)-IF(ISNUMBER(A3),A3,0)

How to calculate number of used columns per row in excel 2007 vba

I want to calculate number of used columns for each row in excel 2007 using VBA.
I am calculating number of used rows by using ActiveSheet.UsedRange.Rows.Count
and now I want that, i just pass cells(1,1).value to a function that give me total number of used column for that specific row.
Thanks
Below example for column A:
WorksheetFunction.Sum(Sheet1.Range("A1:A" & ActiveSheet.UsedRange.Rows.Count ))

VB.NET Code to Change Excel 2007 Column Cell Format to Number no Decimal

VB.NET code to change Excel 2007 Column Cell Format from Text to a Number no Decimal.
Right now Column F shows values that look like
3E+13
3E+13
Manually changing it to a Number with No Decimal shows the correct value.
30000046605562
30000041582875
Of course I would like to automate this.
Select the rows (maybe programmatically) and perform
Selection.NumberFormat = "0"
To select all cells in the sheet call
Cells.Select