Excel - Lookup - Multiple result across multiple worksheets - excel
Im doing a work calendar, that should be filled automatically depending of the day of the week or of the day of the month. Meaning:
I have weekly chores (each are equally every week) and monthly chores (each are equally for every specific work day of the month).
The idea is every time i change the month of the calendar, is filled with the chores needed to be done for each day.
This is the calendar that i'm doing (the red cells are filled by hand, the rest is automatically filled with the formula below):
Calendar
Week Chores sheet
Sheet ToDos week
Month Chores sheet
Sheet ToDos Month
I already filled the weekly chores automatically with:
=IFERROR(INDEX('ToDos Week'!$C$3:$C$98;SMALL(IF((WEEKDAY($C$3;2)='ToDos Week'!$B$3:$B$98);ROW('ToDos Week'!$B$3:$B$98)-MIN(ROW('ToDos Week'!$B$3:$B$98))+1;"");ROWS($L$1:L3)));"")
Works like a charm
But my difficulty now is to add the monthly chores
I Tried to add
=IFERROR(IFERROR(INDEX('ToDos Week'!$C$3:$C$98;SMALL(IF((WEEKDAY($F$3;2)='ToDos Week'!$B$3:$B$98);ROW('ToDos Week'!$B$3:$B$98)-MIN(ROW('ToDos Week'!$B$3:$B$98))+1;"");ROWS($L$1:L1)));INDEX('ToDos Month'!$C$3:$C$91;SMALL(IF((NETWORKDAYS(F$5-DAY(F$5)+1;F$5;holidays)='ToDos Month'!$B$3:$B$91);ROW('ToDos Month'!$B$3:$B$91)-MIN(ROW('ToDos Month'!$B$3:$B$91))+1;"");ROWS($L$1:L1))));"")
of course doesn't work because the part "ROWS($L$1:L1)" of the formula will stretch and will not give me the first occurrence of the month chores (in case there's week chores in the same day), but the third or fourth..
Can you help me with this?
{Big Edit} Okay, I've just realised I overlooked a really simple solution - as demonstrated in an earlied edit, we can use COUNTIF to get the number of Daily Tasks for the weekday. So, we can subtract this from the Monthly Task count to correct the number.
To Simplify: Is the task Weekly or Monthly? (You may need to add/subtract from ROWS to get it to line up)
=IF(COUNTIF('ToDos Week'!$B$3:$B$98,WEEKDAY($C$3,2))>=ROWS($L$1:L3), "Weekly", "Monthly")
Use your existing code for Weekly. For Monthly, just subtract COUNTIF('ToDos Week'!$B$3:$B$98,WEEKDAY($C$3,2)) from the ROWS to remove all the Weekly tasks:
IFERROR(INDEX('ToDos Month'!$B$3:$B$98;SMALL(IF((DAY($C$3;2)='ToDos Month'!$A$3:$A$98);ROW('ToDos Month'!$A$3:$A$98)-MIN(ROW('ToDos Month'!$A$3:$A$98))+1;"");ROWS($L$1:L3)))-COUNTIF('ToDos Week'!$B$3:$B$98,WEEKDAY(C$3,2))>=ROWS($L$1:L3);"")
Replace the "Weekly" and "Monthly" in the IF above, and you get:
=IF(COUNTIF('ToDos Month'!$B$3:$B$98,WEEKDAY(C$3,2))>=ROWS($L$1:L3),IFERROR(INDEX('ToDos Week'!$C$3:$C$98;SMALL(IF((WEEKDAY($C$3;2)='ToDos Week'!$B$3:$B$98);ROW('ToDos Week'!$B$3:$B$98)-MIN(ROW('ToDos Week'!$B$3:$B$98))+1;"");ROWS($L$1:L3)));""),IFERROR(INDEX('ToDos Month'!$B$3:$B$98;SMALL(IF((DAY($C$3;2)='ToDos Month'!$A$3:$A$98);ROW('ToDos Month'!$A$3:$A$98)-MIN(ROW('ToDos Month'!$A$3:$A$98))+1;"");ROWS($L$1:L3)))-COUNTIF('ToDos Week'!$B$3:$B$98,WEEKDAY(C$3,2))>=ROWS($L$1:L3);""))
Old answer below
Okay, there are 2 possible solutions I can think of here... The first, and simplest, only works if your Weekly Tasks and Monthly Tasks are formatted differently (e.g. Monthly tasks may all start "[M]", such as "[M]File Invoices") In that case, replace the ROWS(L$1:L3) with a COUNTIF to count the Monthly tasks (e.g. COUNTIF(L$1:L3;"[M]*"))
If you have no 'easy' way to check weekly/monthly, the next option would be to use a SUM in the Array Formula to compare each entry in $L1:L3 against the ToDos Month list (e.g. SUM(COUNTIF('ToDos Month'!$B$3:$B$91;L$1:L3)), taking advantage of the fact that a COUNTIF where both arguments are arrays will itself return an array)
These 2 options should give you the number of Monthly tasks in your day, for the k of your SMALL function
{EDIT:Removing the 'blank' column} This needs redoing for each week/row. It is based on my test sheet, where cell A14 was 05/02/2018, E14 was 09/02/2018 and the array formula was put into A15 and filled down-and-right to E23
=IF(COUNTIF('ToDos Week'!$B$3:$B$98,WEEKDAY(A$14,2))>=ROWS(A$14:A14),IFERROR(INDEX('ToDos Week'!$C$3:$C$98,SMALL(IF((WEEKDAY(A$14,2)='ToDos Week'!$B$3:$B$98),ROW('ToDos Week'!$B$3:$B$98)-MIN(ROW('ToDos Week'!$B$3:$B$98))+1,""),ROWS(A$14:A14))),""),IFERROR(INDEX('ToDos Month'!$B$3:$B$98,SMALL(IF((DAY(A$14)='ToDos Month'!$A$3:$A$98),ROW('ToDos Month'!$A$3:$A$98)-MIN(ROW('ToDos Month'!$A$3:$A$98))+1,""),COUNTIF(A$14:A14,"Month*")+1)),""))
First thing it does it check how many Weekly tasks there are for the day. If this is greater than the number of tasks already filled out, it looks for a Weekly task, otherwise it looks to a Monthly task - counting the existing Monthly tasks as starting with "Month"
Related
Is a date within several date ranges
I'm trying to put together an excel spreadsheet to show the day-by-day impact of stays by 3rd country citizens in the EU's Schengen area (it's a fairly complex rolling 180 day window). At the moment, I have a column with every day from a start date (so lots of rows) and another where I enter a 1 if there was a stay in a Schengen country for that day. Then other columns calculate when the 180 day period started and how many days have been in Schengen for that day. It's a bit of a faff having to enter a 1 for every day away. I'd like to have another worksheet where I simply enter the start and end dates of (an arbitrary number of) each stay and then the calculation spreadsheet simply works out if each date falls within a stay or not. Working out whether a date falls within one date range is pretty straightforward, but working out if it falls within several date ranges isn't obvious to me. Any suggestions please? After a very fair comment, here's a couple of images that hopefully illustrate what I'm trying to do (please ignore the colours). Example of date ranges, but the number of these should be arbitrary: The calculated sheet - currently I have to enter the 1s individually whereas I'd like them evaluated from the date ranges:
Excel formula for entering bi-weekly dates
I have the following worksheet: The grid is filled with the following formula (this example is from cell H4) that populates the grid based on inputs from the table on the left, =IF($A4="","",IF(AND($E4="Daily",H$2>=$D4,H$2<=$G4),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Weekly",H$2>=$D4,H$2<=$G4,TEXT(H$2,"DDD")=TEXT($D4,"DDD")),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Bi-Weekly",H$2>=$D4,H$2<=$G4,MOD($D4+14,H$2)=0),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(AND($E4="Monthly",H$2>=$D4,H$2<=$G4,TEXT(H$2,"MM/DD/YYYY")=CONCATENATE(TEXT(H$2,"MM"),"/",TEXT($D4,"DD"),"/",TEXT($D4,"YYYY"))),IF(RIGHT($F4,2)="30",LEFT($F4,LEN($F4)-2)&"/",IF(RIGHT($F4,2)="00",LEFT($F4,LEN($F4)-2),$F4)),IF(COUNTIF('PowerPoint Gantt'!$A$5:$A$12,$A4)=1,IF(H$2=VLOOKUP($A4,'PowerPoint Gantt'!$A$5:$E$12,5,FALSE)+31,"R",""),"")))))) The only part of the function that isn't working is the Bi-Weekly selection. I can't figure out how to get recurring entries. I can get the start date and one 14 day period after. I've tried using the CEILING function also but still only gets me the next 14th day marked, instead of every 14th day. And ideas?
In your rule for Bi-Weekly meetings, it seems that MOD($D4+14,H$2)=0 should be replaced with MOD(H$2-$D4,14)=0 The latter takes the difference between the starting date and the actual date and checks to see if that can be divided by 14, the number of days in 2 weeks. Your rule for Weekly meetings could be approached similarly, which seems simpler to me than a rule based on the name of the day, like you are using now.
Number of times an event occurs per year depending on start date and frequency (excel)
I'm trying to develop a formula in MS Excel that will give me the number of occurrences a task will happen in a year (or month), based on a start date, frequency and schedule in a table. I am looking to produce a table like the following (assuming the start date is 01/01/YR1): I'm open to VBA suggestions also. The minimum frequency is completing the task every week. Not taking into account daily tasks here. The data is held in a table. I calculated the 'times per year' using : =IF([#Schedule]="Months",(12/[#Frequency]), IF([#Schedule]="Weeks",(52/[#Frequency]),IF([#Schedule]="Years",1/[#Frequency],0))) I may look to take this onto a monthly schedule also, i.e. number of occurrences for each month across 5 years. It would also be useful to specify an overall end date for when the tasks would stop. (e.g. sometimes it would be year 3, sometimes year 5) Your help is much appreciated!
=IF(D$2=1,ROUND(D$2*$C3-0.45,0),ROUND(D$2*$C3-0.45,0)-SUM($D3:OFFSET($C3,0,D$2-1))) The formula is dragable so just place it in D3 then drag across then down. Also note the change in format of the table so the year numbers are usable in the calculations. Note: I would suggest that the value the 5th year of the 2.5 year frequency is incorrect. In the 3rd year you would do it and have a half year remaining. Then add that to years 4 & 5 and you get 2.5 time to do it again.
Excel - Bi-Weekly Tasks - Fill Calendar
I have a Task month calendar. when i change the month of the calendar it shows me what I have to do which day of the month. I basically have a list of task, when i change the month the tasks date automatically change accordingly a series of rules and that list will populate the calendar. Calendar Tasks But I have some tasks that are bi-weekly, and I dont have a specific week to be done, they have to be done in the fortnight after the last time. so I have the first week (day) that the task was done and i have the first day of the month i am... and with that i would wanted to know which days of the month i have to do that specific task. Can you help me?
use the last reference point as the basis for creating the next due date. this would be the date the task was last performed. If it is due a fortnight from that last date then add 14 days. You may want to record the date that task was performed each time so that your formula is based on the date it was last completed each time it is calculated. If you are wanting to plan ahead then make an assumption that it will be done in consistent 14 day iterations then build your formula to consider the actual date it was completed to readjust the plan going forward. So it will assume this will be done consistently until advised otherwise with an actual date it was last completed.
The trick is to get the first date in the month that matches the weekday of the last date and then you can easily add 14 days. Much like finding the first Monday/Sunday in a month to build a calendar. A1 contains the last time the task was performed C1 contains the 1st of the month C1+7-WEEKDAY(C1+7-weekday(A1)) will return the next weekday that matches the weekday the task was last performed. =C1+7-WEEKDAY(C1+7-weekday(A1))-A1 returns the number of days since =(C1+7-WEEKDAY(C1+7-weekday(A1))-A1)/2 returns the number of days divided by 2. If this result is not a whole number (#.5) then it's not in the bi-weekly cycle and we need to add another 7 days to get the correct start date. If it is a whole number then it is our start date. We can use the mod function to find out if there is a decimal value. =if(mod((C1+7-WEEKDAY(C1+7-weekday(A1))-A1)/2,1)>0,C1+7-WEEKDAY(C1+7-weekday(A1))+7,C1+7-WEEKDAY(C1+7-weekday(A1))) Below or next to this cell you can simply reference the cell and add 14 =D1+14 and then add as many as you want to display.
Time series mock data generation for 16 years of quarterly data in Excel or Matlab
I would like to generate a mock time series quarterly dataset from, say, 2000-2016 for a variable (quarterly credit growth) that averages around a certain value (say, 30%). Can anyone give a suggestion on how to do this in principle? Edit: what I was implying were the actual data values for each time period, i.e. data with a certain mean and variance. Found a solution with a code in Matlab, for anyone interested, see below in answers.
Excel approach: You can make column A your date list. In A1, or A2 or more if you have header rows, you will have to seed your list by providing the first start date. Lets assume you put your seed date in A2. I would then go about adding 3 month to you start date using a formula, and copy down until you have hit your desired date. In order to add the 3 months I would use the following in A3. =date(year(A2),Month(A2)+3,day(A1) that will give you the first day of the month every 3 months. If you want the first day of the month every 3 months, set the day to 1 like so: =date(year(A2),Month(A2)+3,day(A1) And end of month could be calculated as: =eomonth(date(year(A2),Month(A2)+3,day(A1)),0) however I would prefer to do the end of month calculation based on the row you are in so I would do it more like: =EOMONTH($A$2,(rows($A$2:A3)-1)*3)