List of Days in Week Number Excel - excel

I have a Date. Ex: 1/1/2017.
I have a week number. Ex: WEEKNUM(1/1/2017) = 1.
How can I list all 7 days, starting from Monday - Ending on Sunday.
Thanks

The way to do it is like this:
=Text(A1,"dddd")
Or if I understood you correctly, something like this may do the job:
=(A1*7)+Date(2017,1,1) to give you the first day in the a1 week.
You may add +1 at the end of the formula.
In general, some interesting formulas here:
http://www.mrexcel.com/archive/Dates/29795.html
Edit:
Try this :
=DATE(Yr,1,1+(Nth-(Dow>=WEEKDAY(DATE(Yr,1,1))))*7)+
Dow-WEEKDAY(DATE(Yr,1,1))
Taken from here:
http://www.cpearson.com/excel/DateTimeWS.htm#NthDoWYear

With week numbers in Row1 (1 in A1) then in A2 copied down to A8 and A2:A8 across to suit:
=DATEVALUE("1/1/17")+7*(A$1-1)+ROW()-1

Related

Finding data for a determined week

I have a table and I have a date in cell B4 which is something like 15/03/2021
I want to count values where the start date is the value on cell B4 but also count everything till the end of that week. So everything from Monday 15/03/2021 to Sunday 21/03/2021
What I have so far is something like
=COUNTIFS(MySheet!A:A,"Y",MySheet!C:C,">="&B4)
My trouble is how to tell it "also count everything until sunday that week without having to manually put the end date into a cell
Add 6 to the value in B4 to get the second criteria.
=COUNTIFS(Mysheet!A:A,"Y",Mysheet!C:C,">="&B4, Mysheet!C:C,"<="&B4+6)
I assume the question behind your question is how to account for dates in B4 other than a monday and keep counting untill the end of that same week, therefor you can use:
=COUNTIFS(Mysheet!A:A,"Y",Mysheet!C:C,">="&B4,Mysheet!C:C,"<="&B4+7-WEEKDAY(B4,2))
This does set a Sunday as the "end" of the week as per your OP.
Your question is slightly ambiguous, so there are two possible answers
To count for exactly 7 days:
=COUNTIFS(MySheet!A:A,"Y", MySheet!C:C,">="&B4, MySheet!C:C,"<"&B4+7)
To count until the end of the next Sunday: (N.B. On Sundays, this will only count 1 day)
=COUNTIFS(MySheet!A:A,"Y", MySheet!C:C,">="&B4, MySheet!C:C,"<"&B4+8-Weekday(B4,2))
This works by saying "on or after (>=) the date given", and "before (<) 7 days later / the following Monday"

Days of the Week On Excel

I am trying to do something with the days of the week. I have a cell on Sheet1 called 'Yr Overview' where a user inputs the day of the week.
On a second page I am reference thing by using =left('Yr Overview'!A1,1) so that is a user inputs a day like Sunday, if just shows it as an S. I have it working up to this point. Now I am trying to make that cell effect others on the same sheet.
So that is A1 = S A2 = M (S + 1 day) A3 = T (M + 1 day) etc.. I seem to be unable to do this, so I am just asking if this is possible? Or would I need to use VBA to achieve this.
Try this in A2 and copy down:
=INDEX({"MON","TUE","WED","THU","FRI","SAT","SUN"},MATCH(UPPER(LEFT(A1,3)),{"SUN","MON","TUE","WED","THU","FRI","SAT"},0))
Try this out. Enter this formula in cell A1 and drag to the right.
=LEFT(TEXT(MATCH('Yr Overview'!$A$1,{"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"},0)+COLUMN()-1,"dddd"))
Below solution helps only if in case of input date instead of day.
A1- 07/14/2017
A2=TEXT(A1+1,"dddd")
A3=TEXT(A1+2,"dddd")
A4=TEXT(A1+3,"dddd")
A5=TEXT(A1+4,"dddd")
A6=TEXT(A1+5,"dddd")
A7=TEXT(A1+6,"dddd")
In A2 add this formula:
=IF(ROW()<8,IF(FIND(LOWER(LEFT(Sheet1!$A$1,3)),"montuewedthufrisatsun",1)+(ROW()-1)*3<=LEN("montuewedthufrisatsun"),UPPER(LEFT(MID("montuewedthufrisatsun",FIND(LOWER(LEFT(Sheet1!$A$1,3)),"montuewedthufrisatsun",1)+(ROW()-1)*3,3),1)),UPPER(LEFT(MID("montuewedthufrisatsun",FIND(LOWER(LEFT(Sheet1!$A$1,3)),"montuewedthufrisatsun",1)-(ROW()*-3+24),3),1))),OFFSET(A2,-7,0))
Assumes day is input in cell A1 on Yr Overview

Excel - SUMIF and Weekday

Note: I am putting this question as Excel and Google Docs as they have a ton of overlap for simple questions like this.
I have two columns of data. A date of a purchase and how much that purchase was for.
A B
11/23/2015 $59
12/5/2015 $23.32
1/21/2016 $12.09
1/22/2016 $78.21
1/22/2016 $5.88
2/14/2016 $0.13
... ...
(thousands of rows below this)
I want to SUM the amount of money spent on Mondays, Tuesdays, Wednesdays, etc.
If I use SUMIF, I run into this problem:
=SUMIF(A:A, WEEKDAY(A:A), B:B)
^ WEEKDAY only takes in a single date value.
I do not want a function that I have to drag downwards.
How would I accomplish this?
Try this query function:
=QUERY({A:B},"select dayOfWeek(Col1), sum(Col2) where Col1 is not null group by dayOfWeek(Col1)")
In this formula I used Array {A:B} and notation Col1, Col2... in the formula because now when you add new columns, the formula won't fail.
And the similiar formula, using sumif:
={arrayformula(unique(weekday(A:A))),arrayformula(sumif(week‌​day(A:A),unique(week‌​day(A:A)),B:B))}
In Excel you do it with this Array formula. Array formula needs to be entered with Ctrl-Shift-Enter.
{=SUM(IF(WEEKDAY($A$2:$A$1000,1)=E2,$B$2:$B$1000,0))}
This assumes your day of week in number is E2. The second parameter in Weekday function defines how you number the days of Week. Here I have used 1 which means 1 = Sunday and 7 = Saturday

How to sum column-b values while column-a values are the same?

I've simulated my problem.. because my original plan is complex to describe:
I need C4 to be 8 because A2 = A3 = A4, and 5 + 2 + 1 results in 8.
Using this logic, the expected results should be:
C4:8 C6:10 C10:23 C12:23
Well, my problem:
I can't use sumif due after the last day of the month (28, 29, 30 or 31) the next day will be 1 again.
I'm stucked on that. Any help would be appreciated.
Thank you for your time.
If it needs to be in the same table I'd go with:
=IF(C2<>C1,SUMIFS([Number],[Day],[#Day],[Month],[#Month]),"")
Where column C contains the days. This way only the first row will show the sums.
Or you could use an extra table containing Year, Month and day and use:
=SUMIFS([Number],[Day],[#Day],[Month],[#Month])
to collect your data and have it aggregated into one table for further use.
In C2 enter:
=IF(A2=A3,"",SUM($B$2:B2)-SUM($C$1:C1))
and copy down
EDIT#1:
The first part of the IF insures blanks where they are needed. The second part of the IF adds up all of column B, but removes parts of B that already appear in column C
Maybe something like the following. The formula in the first cell is different than the others:
The numbers in between your target cells are still showing - is that a problem?

SUM data according to dates in Excel

My problem is the following...
I have a little aeroplane and I need to track the hours. I have to track the hours by sectors and not the total of the day (that's why sometimes I have 2 or 3 on the same day).
Now this is the problem... On column C I need to SUM the hours of the last 7 days. And any given 7 days, not just last week. To do it manually is quite easy... the problem is that I need a formula as my records are quite large...
Here with a small example (let's say that there was NO HOURS before 15/01/2009)...
COLUMN A-------COLUMN B-------COLUMN C
DATE--------------HOURS-------HOURS LAST 7 DAYS
15/01/2009-------01:00-------01:00
15/01/2009-------02:15-------03:15
16/01/2009-------01:15-------04:30
17/01/2009-------01:30-------06:00
18/01/2009-------01:30-------07:30
18/01/2009-------01:00-------08:30
18/01/2009-------02:00-------10:30
19/01/2009-------02:30-------13:00
19/01/2009-------03:00-------16:00
20/01/2009-------////////--------16:00
21/01/2009-------01:00-------17:00
22/01/2009-------01:30-------15:15
23/01/2009-------02:00-------16:00
I've been fighting for the last weeks trying to figure out a formula but no luck... any suggestions?
Thanks
Another solution that basically does much the same as the earlier offered solutions:
In C1, enter the following formula:
{=SUM(IF(($A$1:$A1>=($A1-6))*($A$1:$A1<=$A1), $B$1:$B1, 0))}
And then just drag the formula down.
If you're not familiar with array formulas, the {} outer brackets just indicate that the formula is an array formula. To get it to execute correctly, you need to copy the part inside the {} brackets into the formula bar, and then hit Ctrl+Shift+Enter to indicate that it's an array formula.
First thing is to get the begin date, which would be the following function:
=Now() - 7
If you renamed that cell to "WeekBegin", then you could use the following formula to calculate the total hours:
=SUMIF(A:A,">=" & WeekBegin,B:B)
Notice that I used column references; this was to both simplify the formula, but also allow you to add new data to the end of the range easily. You will need to take care that your WeekBegin cell is not in that column A or column B, otherwise you'll get a circular reference warning.
If you planned to have numeric data above or below your input range, you would need to explicitly call out the sum and criteria ranges as follows:
=SUMIF(A2:A14,">=" & WeekBegin,B2:B14)
Additionally, you may find that your result comes up initially as a decimal. That's Excel's date serial format, so you may need to format your result as time.
Hope that helps!
[Edit: On second pass, if you're looking to sum a range based on a from and to date (so any 7 days as you seem to imply in your post), look for the previous poster's note, i.e.:
=SUM(B:B) - SUMIF(A:A, "<="& BeginDate, B:B) - SUMIF(A:A, ">"& EndDate, B:B)
A more elegant solution is offered in Excel 2007 using the SumIFS() function:
=SUMIFS(B:B, A:A, ">=" & FromDate,A:A, "<" & ToDate)
Note that the arguments for SUMIFS are in a different order than the standard SUMIF.
Happy Summing!]
Here's the data in better format if someone wants to try:
15-Jan-2009 01:00
15-Jan-2009 02:15
16-Jan-2009 01:15
17-Jan-2009 01:30
18-Jan-2009 01:30
18-Jan-2009 01:10
18-Jan-2009 02:00
19-Jan-2009 02:30
19-Jan-2009 03:00
20-Jan-2009
21-Jan-2009 01:00
22-Jan-2009 01:30
23-Jan-2009 02:00
I got the function:
=SUM($B$1:$B$13)-SUMIF($A$1:$A$13, "<="& (A1- 7), $B$1:$B$13) - SUMIF($A$1:$A$13, ">"& (A1), $B$1:$B$13)
This was based on Sum of named ranges conditional to date?.
The idea is to first compute the total sum: SUM($B$1:$B$13)
then subtract any values that happened older than 7 days ago: SUMIF($A$1:$A$13, "<="& (A1- 7), $B$1:$B$13)
then subtract any values that happened in the future: SUMIF($A$1:$A$13, ">"& (A1), $B$1:$B$13)
The point is to use SUMIF function, which "adds the cells specified by a given criteria."

Resources