Using index in excel how to get a 6th value from a array - excel

I am trying to get 6th day from the day itself and should repeat for 3 times but I am not able to get the desired output
Column A Column B(Expected output)
Sunday Sunday
Monday Friday
Tuesday Wednesday
Wednesday Monday
Thursday Saturday
Friday Thursday
Saturday Tuesday
Sunday
Wednesday
Monday
Saturday
Thursday
Tuesday
Sunday
Wednesday
Monday
Saturday
Thursday
Tuesday
Sunday
I am using:
=INDEX($E$1:$E$7,6)
and I am getting only Friday and if I do auto fill only Friday is copied to all cells.
Any assistance much appreciated.

If I understand you correctly, you want to show the name of every sixth day from a starting date. There are different approaches to that. The Index() one is a possibility, but not the easiest.
Easier: In the first cell (B1), enter the starting date. Format with custom format "dddd".
In the next cell down use a formula
=B1+5
and format with custom format "dddd". Copy down as far as desired.
OR use
=TEXT($B$1+((ROW()-1)*5),"dddd")
and copy down.
If you want to base this on today's date, you can start in B1 with
=TEXT(TODAY()+((ROW()-1)*5),"dddd")
and copy down.
EDIT: if the cell contents is not about dates and weekdays, but just any text or value, then you can use the Index() approach. For an array with seven values, you want to extract every 6th value, looping through the seven values. That would mean that the values are accessed in the following order:
1
6
4
2
7
5
3
Therfore, you need a formula that delivers this number sequence. This formula, if started in row 1 and copied down, does that:
=(1+((ROW()-1)*5))-((INT((1+((ROW()-1)*5))/7)-IF(MOD((1+((ROW()-1)*5))/7,1),0,1))*7)
Wrap an Index around it and adjust your column references. In B1 and copied down to B21:
=INDEX($A$1:$A$7,(1+((ROW()-1)*5))-((INT((1+((ROW()-1)*5))/7)-IF(MOD((1+((ROW()-1)*5))/7,1),0,1))*7))

Related

Formula based on first monday or tuesday etc of the week

Is there a way to put a year into a cell (say A1), then the day of the week you want (say Monday in cell A2) and enter into the 12 cells below it the first monday of each month (or first tuesday, etc, based on whats in cell A2)?
I have been able to figure out how to do it with 1 day but I would like it to be interactive.
=DATE(2022,{1;2;3;4;5;6;7;8;9;10;11;12},7-WEEKDAY(DATE(2022,{1;2;3;4;5;6;7;8;9;10;11;12},1)-5,3))
With Office 365:
=LET(yr,A1,
wkdy,MATCH(PROPER(A2),{"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"},0),
mnt,SEQUENCE(12),
DATE(yr,mnt,1)+MOD(8-WEEKDAY(DATE(yr,mnt,1),10+wkdy),7))
You where pretty close with your formula
=DATE(A1,{1;2;3;4;5;6;7;8;9;10;11;12},7)-WEEKDAY(DATE(A1,{1;2;3;4;5;6;7;8;9;10;11;12},7),A2)
Where
A1 = year string
A2 = day of the week as number (1 = Saturday, 2 = Sunday, etc.)

Formula to select a date 3 business days later than the cell on its left

In my Excel workbook, I have "November 10th". I want every cell in the column to the right to display a date 3 days later, but it has to be a weekday Monday - Friday, it can't fall on a Saturday or Sunday. So if "November 10th" is a Thursday the date on the cell next to it should state "November 14th".
Having the date in A1, use =WORKDAY(A1,3).
You can also put the third argument to exclude holidays in this function.

Summing hours between range of dates, looking up to separate table in excel

In cells A1:B6 I have the following info.
Weekday Hours
Monday 5
Tuesday 5
Wednesday 0
Thursday 5
Friday 0
In cells A8:B9 I have a date range, e.g.
From: To:
09/01/19 11/01/19
In cell C9 I want a formula which tells me how many hours are between the from and to dates. Not the total number of hours, but the sum of hours as they appear in the weekday table.
There is a helpful article on exceljet which got me some of the way here., but I got tangled in the array formulas and could not fix it.
The result of the formula should be: 5. ie. there are 5 hours between Wednesday 09/01/2019 and Friday 11/01/2019. (dd/mm/yy)
Any help is gratefully received.
Use SUMIFS:
=SUMPRODUCT(SUMIFS(B:B,A:A,TEXT(ROW(INDEX(XFA:XFA,D2):INDEX(XFA:XFA,E2)),"dddd")))

Excel : Weeknumber within month with criteria

I'm trying to make a formule to calculate the weeknumber within a week but with certain criteria. The week always starts on a monday. But if the thursday of that week is in the next month, then that weeknumber is part of the next month.
[enter image description here][2]
Right now I have the following formula:
=INTEGER((6+DAY(A4+1-WEEKDAY(A4-1)))/7) where A4 is the date.
This already calculates the weeknumber within the month, but not with the criteria of thursday. An extra added criteria is that the weeknumber should start from 6am on monday instead of at midnight. But that I can solve with an extra column to check for that.
Thanks in advance!
Consider working out the week number from the previous week number:
If it is Monday then
If following Thursday goes into the next month, reset to 1
Else increase by 1
Else use same value
So starting with a 1 in E4
=IF(WEEKDAY(A5)=2,IF(MONTH(A5+3)>MONTH(A5-4),1,E4+1),E4)
entered in E5 and copied down.
EDIT
Above works for 2017 but would need slight change to work for 2018 and onwards because month decreases from 12 to 1 across year boundary:
=IF(WEEKDAY(A5)=2,IF(MONTH(A5+3)<>MONTH(A5-4),1,E4+1),E4)
I cant upload a workbook but here is a solution:
Row 2 is headers
Row 3 is empty
B4 going down is the date(01/01/2017 up to 31/12/2017)
C4 =WEEKDAY(B4,2)
D4 =VLOOKUP($C4,$L$3:$M$9,2,0)
E4 =MONTH(B4)
F4 to J4 are empty
F5 =IF(C5=1,F4+1,F4)
G5 =IF(C5=4,11,0)
H5 =IF(MAX(E5:E11)-MIN(E5:E11)<>0,22,0)
I5 =IF(AND(C5=4,SUM(G5:G11)+SUM(H5:H11)>22),I4+1,0)
J5 =IF(H6-H5<0,1,IF(H6=22,J5,IF(OR(C6=1,I6<>0),J5+1,J5)))
L3 to M9 are vlookups
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
5 Friday
6 Saturday
7 Sunday
Does that work ok for you?
In my experience most of those week number questions can be answered with some variation of your original formula - in this case this version should cater for Monday week start with the Thursday determining the month
=INT((6+DAY(B4+4-WEEKDAY(B4-1)))/7)
That works for a date in A4 but assuming you have a date/time in A4 and the week doesn't start until 06:00 on Monday then you can tweak that as follows:
=INT((6+DAY(B4+3.75-WEEKDAY(B4-1.25)))/7)

Excel date and text Format

I have an excel sheet in which there is a column of data like the one given below
Last day of this week corresponding to Sunday is 41280
Last day of this week corresponding to Sunday is 41287
Last day of this week corresponding to Sunday is 41294
Last day of this week corresponding to Sunday is 41301
Last day of this week corresponding to Sunday is 41308
Last day of this week corresponding to Sunday is 41315
Last day of this week corresponding to Sunday is 41322
This is a file from our client. But we are expecting the last numeric values to be of date format.
Last day of this week corresponding to Sunday is 1/6/2013
I tried changing the format to date, but it is not accepting
How can i achieve the same
Put this formula in the next column along (formula assumes your text is in column A):
=TEXT(RIGHT(A1, 5), "dd/MM/yyyy")
I've dropped in the UK dateformat, but of course you can go for the dateformat that suits you.
Changing the format of the cell should do the job. So changing from Number or General to Short Date or Long Date works for me.
I have a neat function that I use with a date in Excel. If I want text to appear in the same cell as the date, I use the following concatenation function.
What I want to see: Date of Submission: 10/17/2016
What I type in: ="Date of Submission: "&TEXT(NOW(),"MM/DD/YYYY")

Resources