Using DateTime when referencing a cell with SUMIFS() - excel

I am using the following SUMIFS() function:
=SUMIFS(A:A, B:B, C1)
Column B:B contains dates in the following format:
2014-01-01 01:14:44
Now in cell C1 I'm not sure how to format the date so that it will grab all records that match all records that fit what's in cell C1. I have the following:
2014-01-01
but it return nothing. How do it make it so that it grabs the date, but doesn't discriminate the time portion?

You can leave C1 as a date and the data as it is - just change your formula to the following
=SUMIFS(A:A,B:B,">="&C1,B:B,"<"&C1+1)
Excel stores dates as integers, times are simply fractions of the day so every C1 date (no matter what time) falls somewhere between C1 and C1+1. This formula gets that data

The simplest way may be to keep your formula as is, other than changing C1 to D1, but insert a column immediately to the right of A with:
=INT(C1)
copied down to suit.

Related

In one specific cell have it output to 2 specific cells

What I would like to do is use a excel function in one specific cell to output to the cell next to it. So as you can see in the image below I enter =TODAY(). What I would like to do is in cell c4 is used today function to enter todays date in cell 4 and in Cell d4 enter the date 3 days later. So if possible in cell c4 I would enter a function that states todays date in cell c4 and the workday 3 days later.
For versions that support Dynamic Arrays, create a formula that Spills the result you want
Example
=WORKDAY(TODAY(),{0,3})
To make the number of days offset variable, use SEQUENCE to generate the offsets
=WORKDAY(TODAY(),SEQUENCE(1,2,0,D7))
For Non-Dyanamic Array versions, the first formula could also be entered as a array formula (CSE) into C4:D4
If you only ever want to use Today() as the starting date, you can use this:
=TEXT(TODAY(),"ddd, dd-MM-yyyy")&" - next workday: "&TEXT(WORKDAY(TODAY(),3)," dddd")
If you want the user to enter a date, that entry must be in a different cell, and you need to replace the Today() function in the formula above with that cell reference.

Excel Convert Now() to a Number to compare against another Number

I am trying to use some logic in a spreadsheet without any macros.
First I have a sinle cell that gives the date and time. I then used the custom format on that cell to just show the "h". So only hour numbers 1 through 24 appear in this cell. (e.g. at 3:20 p.m. I get 15 in the cell). (Cell # A:1)
=now()
Second, I have a separate single column with 24 rows numbered 1-24 (Cell #'s B1:B24)
I have a third column that has logic that states "Night" shift" for numbers 23 & 0-6; "Day Shift" for numbers 7-14; and "Mid Shift" for numbers 15-22) (Cell #'s C1:C24)
=if($A$1=B1,"Night Shift","")
However, the third columns all appear blank even tough one should appear. I tried changing A1 using text(A1,"#") but I get the serial number. Is there an easy way to dynamically have a value in column C show what shift based off the hour of the day in cell A1. Column D simply concatenates all 24 cells since there will only be one number ever. (Cell # D1). Thanks for any help.
You could use a LOOKUP formula to return the shift based on a time/date value in A1, e.g.
=LOOKUP(HOUR(A1),{0,7,15,23;"Night","Day","Mid","Night"})&" Shift"
Changing the format of the cell containing the date and time does nothing to the actual contents of the cell. It will still contain a value such as 43706.75 (number of days and fractions of days since 1/1/1900).
If what you want to do is determine the shift for the date/time in A1, you could use a formula like:
=IF(AND(HOUR(A1)>=7,HOUR(A1)<15),"Day Shift",IF(AND(HOUR(A1)>=15,HOUR(A1)<23),"Mid Shift","Night Shift"))
And similar logic if you need to apply different multipliers for the salary.
If you need something else, be more specific.
By doing =now() without any formatting you get the Date and the Time. Then in cell A2 do
=(A1-INT(A1))*24
Then in cell A3 do
=INT(A2)
This gives you the hour number extracted from a date format so a comparison can be made in column C against the numbers in column B. Thanks.

How to make a list of 12 months (loop) not starting at the first month?

Given a date, ex. 05/05/2006, I need to name 12 columns starting with the month of the date given. I realize that I need to make a list of months, I just don't know how to loop it (ie. if one of the months in the middle is December, the next one needs to be January).
The only way I know, from other programming experience, is to make the first column equal to the first month, then make nested conditional statements for the other columns
IF(A1="Jan","Feb",IF(A1="Feb","Mar".......))
I'm sure that there's a better way to do it than brute force (plus, excel doesn't allow me to input that many nested conditionals).
This formula should do the trick:
=TEXT(DATE(2014,MONTH($A$1)+COLUMN()-2,1),"mmmm")
The starting date should be in A1 and first header in B column. If the first header is in another column, you should replace 2 in COLUMN()-2 with the column number.
In the first month column, use =TEXT(A1,"MMMM") where the date is in A1... In the subsequent columns, use =TEXT(EDATE(DATEVALUE("1 "&B1),1),"MMMM") to make a date from the month name, add a month and convert to text.
Assuming your date is in A1, and your columns are in B1 - M1:
Set B1 = A1.
Set C1 = EDATE(B1, 1). EDATE adds the specified number of months to the specified date.
Copy C1 to D1 - M1.
Now you have twelve columns containing the original date and the same date on eleven successive months.
Select B1 - M1; Format Cells; under Number, select Custom; and under Type, enter mmm. This will format these dates to just show the abbreviated month.
Assuming A1 has the date. The following should work
B1= A1 (format as "mmm")
C1 =EOMONTH(B1,1) (format as "mmm")
Copy the above formula and format from C1 for the other columns
Assuming the date is in A1
=TEXT(EDATE(A1,0),"MMMM")
The next column would be
=TEXT(EDATE(A1,1),"MMMM")
... and so on.

How can I extract month name and quarter from a date in Excel?

I would like to take date information from cell A1 (e.g. 10/10/2013 09:00) and transfer the month into cell B1 (October) and then based on the month fill in cell C1 the proper quarter (Q4). How can I do this in Excel?
To get the month from A1, simply do, at B1
=(A1)
To get the quarter of A1, based on B1, I like to use this formula on C1:
=INT((B1-1)/3)+1
If you want a column that shows month names, use the following formula (you may have to use , instead of ;:
=TEXT(A1;"mmm")
One problem with this approach is that you can't use this formula on B1, or else the formula on C1 won't work. That is, unless you bypass B1 and have C1 referr directly to A1, like this:
=INT((MONTH(A1)-1)/3)+1

Excel Date Formula

I have 3 cells in Excel as follows:
Cell
A1=2012
A2=12
A3=15
Which contains year, month & date value respectively. And I want to make a date string out of it.
I know it's very easy to achieve using Date function.
But I also want the cell to remain blank if any of A1,A2 or A3 is blank.
something like
=IF(COUNT(A1:A3)=3,DATE(A1,A2,A3),"")

Resources