How can i add minuts in current Datetime in excel with the help of formulla? - excel-2007

I have a excel sheet in which i want to add 10 minute.
Example of output as :
Actual Time is : 10/2/2013 12:30:00 , so in this time i want to add 10 minute so i need output as 10/2/2013 12:40:00.
Please provide me formula for this.
Many Thanks,
Tausif.

The answer is covered in Excel Help:
if you use the TIME function, then =A2+TIME(0,10,0) will add 10 minutes to the time in cell A2; +TIME(1,0,0) adds 1 hour, etc.

Try this: (assuming your date data is in the C3 cell)
=C3+TIME(0,10,0)
The first parameter is for hours, second is for minutes, third is for seconds.

Related

Not sure how to create a SQL formula that subtracts timestamps in the same column to get the seconds between actions

Need assistance with creating a "datediff" type of formula.
I have timestamps in the {incilog} table, in different rows across the same column {incilog.timestamp} that I need to subtract from one another, but only if the {incilog.transtype} equals "TR" from the row that has the {incilog.transtype} equal "FPS".
Logic is: If {incilog.transtype} equals "TR" and {incilog.transtype} equals "FPS", then subtract {incilog.timestamp} from {inciog.timestamp} in the corresponding row.
Basically, I need to get how many seconds it took from "TR" to "FPS".
THANK YOU FOR YOUR TIME AND ASSISTANCE!
EXAMPLE OF DATA
timestamp
inci_id
transtype
descript
8/22/2022 12:14:46 AM
2022264051
TR
Time Received
8/22/2022 12:17:00 AM
2022264051
FPS
Fire Pri. Started

Calculate the only necessary difference and Group by between two Timestamps in PostgreSQL

I see similar question but didn't find helpful answer for my problem.
I have one query:
select au.username
,ej.id as "job_id"
,max(ec."timestamp") as "last_commit"
,min(ec."timestamp") as "first_commit"
,age(max(ec."timestamp"), min(ec."timestamp")) as "diff as age"
,to_char(age(max(ec."timestamp")::timestamp, min(ec."timestamp")::timestamp),'HH:MI:SS') as "diff as char"
,et.id as "task_id"
from table and etc..
And that my output(Sorry for picture but its best view):
So, as you can see I have timestamp with zones, and I trying calculate difference between last_commit and first_commit. Within function age its goes well, but I need extract only hours and minutes from this subtraction. N.B! only hours and minutes not days for example job_id=1 first row, the difference is 2 minutes and 42 seconds and where job_id=2 second row, the difference is 2 hours and 2 minutes and 55 sec, not 16 days X 24 hours, I don't need calculate days. When I try to_char its return not exactly what I expect. Last two columns within green color in my picture, show what I expect and want. So for every row calculate difference between last and first commit included only hours and minutes (in other words calculate only time not dates) and calculate total sum by task_id as represent in last column in pic.
Thanks.
try this :
SELECT age(max(ec."timestamp"), min(ec."timestamp")) - date_trunc('day', age(max(ec."timestamp"), min(ec."timestamp")))
You can try converting a Timestamp type to just time, like in this answer.
The result of string SQL is:
select au.username
,ej.id as "job_id"
,max(ec."timestamp") as "last_commit"
,min(ec."timestamp") as "first_commit"
,(max(ec."timestamp")::time-min(ec."timestamp")::time) as "diff as age"
,to_char(age(max(ec."timestamp")::timestamp, min(ec."timestamp")::timestamp),'HH:MI:SS') as "diff as char"
,et.id as "task_id"
There are otres possible solutions working with timestamp, but this one i consider simple.

Split date_start and date_end by hours on Metabase

I have table with a column "Begin At" and another column "End At" that represent when a task begin and when a task end i would want to have a Bar display which display the cuantity of tasks that are being done in a specific hour along an interval of time.
For example, from the following table
I would want to be able to see that from 07/12/2021 21:00 to 07/12/2021 22:00 there were 3 tasks being done (row 1, row 2, row 3).
And also as i will have several thousands of rows i would want to use the date widget from metabase in order to specify range of times.
I have been struggling with this from the last week, i tried to create auxiliar questions where to query after but finally my only succeed was to hard code the 24 hours from a day but then i was not able to use the time widget and i needed to specify the dates myself on the sql each time i want to check a specific day and also i only was able to check from 24 to 24 hours, not from for example 02/12/2021 6:00 to 04/12/2021 18:00
My metabase is running on a PostgreSQL database. Is this even possible on Metabase? If not what are your advices to build this? Other plaforms? Pure SQL? Python?
Thank you so much
I am not sure about metabase but from a PostgreSQL point of view this calls for the use of range-types, specifically the tsrange/tstzrange, depending on whether you have time zone information or not.
So a query could be:
SELECT
*
FROM "someTable"
WHERE
tsrange("Begin At", "End At", '[)')
&&
tsrange('02/12/2021 6:00', '04/12/2021 18:00', '[)')
However I don't know how you would get the '02/12/2021 6:00' and '04/12/2021 18:00' out of your metabase user-interface.

Amount of overlaps per minute

I would like to make an SQL-Statement in order to find the amount of users that are using a channel by date and time. Let me give you an example:
Let's call this table Data:
Date Start End
01.01.2020 17:00 17:30
01.01.2020 17:01 17:03
01.01.2020 17:29 18:30
Data is a table that shows when an user started the connection on a channel and the time the connection was closed. A connection can be made any time, which means from 00:00 until the next day.
What I am trying to achieve is to count the maximum number of connections that were made over a big period if time. Let's say 1st February to 1st April.
My idea was to make another table with timestamps in Excel. The table would display a Timestamp for every Minute in a specific date.
Then I tried to make a statement like:
SELECT *
FROM Data,Timestamps
WHERE Timestamps.Time BETWEEN Data.Start AND Data.End.
Now logically this statement does what is supposed to do. The only problem is that it is not really performant and therefore not finishing. With the amount of timestamps and the amount of data I have to check it is not able to finish.
Could anybody help me with this problem? Any other ideas I can try or how to improve my statement?
Regards!
So why dou you create another table in Excel and not directly in MS Access and then why won't you set up the indexes of the timestamps right. That will speed it up by factors.
By the way I think that your statement will print repeat every user that happened to match your Start .. End period, so the amount of rows produced will be enormous. You shall rather try
SELECT Timestamps.Time, COUNT(*)
FROM Data,Timestamps
WHERE Timestamps.Time BETWEEN Data.Start AND Data.End
GROUP BY Timestamps.Time;
But sorry if the syntax in MS Access is different.

Using the Formula SUMIF() and WHEN() in Excel

I tried a Formula in Excel for the following condition. In the first line I have the month from January to March. All the values which are corresponding to the months are in the second line. I want to sum up these values. For example the values from month January would be 30.
I got it figured out up to this formula: =WENN(A1:J1;SUMMEWENN(A1:J1;MONAT(1);A2:J2)) . I am searching in the entire row for the month 1 ( January ) but when I copy this for Feb it does not work I get the same result. By the way it is the German version :-)
thx all.
It looks like your top row is formatted as text. If that is the case then this might be a possible solution for you:
For January: =SUMMEWENN($A$1:$J$1,"01",$A$1:$J$1) which would yield 30
For Feb: =SUMMEWENN($A$1:$J$1,"02",$A$1:$J$1) which would yield 17
For March: =SUMMEWENN($A$1:$J$1,"03",$A$1:$J$1) which would yield 26
Let me know if something is unclear.
EDIT:
This second portion might be easier because you can put it in cell A5 then drag it down to cell A7.
=SUMMEWENN($A$1:$J$1,MONAT(DATWERT(A5&"1")),$A$1:$J$1)
You need to freeze the range "A1:J1". Use the below Code
=WENN($A$1:$J$1;SUMMEWENN($A$1:$J$1;MONAT(1);$A$2:$J$2))