Match Excel Date Range with Day of Week - excel

I have a expense form with a departure and return date. I would like to match all dates between the departure date and return, inclusive, to the day of the week and then populate that date under the appropriate day of the week that exists in another part of the form.
I've provided an example screenshot of what I'm trying to populate and what I'd like it to look like.
I've tried index/match, creating tables to allow the "in between" dates to expand automatically, linking to a date table in powerpivot, etc. and keep failing. I haven't tried an VBA yet.
Your thoughts are much appreciated!

There's plenty of ways to do this. Along similar lines to what you have tried, I got this. It works as per your screenshot and also tested with different dates below:
Formulas.
E1: =B1
E2: =E1+1 and drag down
F1: =IF(E1<=$B$2,TEXT(E1,"ddd"),"") and drag down
B12: =IFERROR(INDEX($E$1:$E$7,MATCH(B11,$F$1:$F$7,0)),"") and drag across

Related

EXCEL Online - Pull entire column of data where condition (without VBA)

trying to figure out how to summarise some data quickly.
I have here an example of what I am trying to do in the attached picture.
Basically - I have a yearly planner with some names, and on various dates there's a X marking that person on that date.
I need to be able to summarise on either the bottom or a new sheet, the total days as a list of days where there's a mark. The data also needs to be presented in the same format - with all names shown even if there's a blank in that days cell.
I can't use VBA because I'm forced to use EXCEL online unfortunately.
I basically want (from a coders perspective) select column where column not null.
Can anyone help me understand how I would do this please? If not I'll have to manually go through and pull out the columns on a weekly basis
Thanks!
Example
It took a few hours to build a solution.
https://1drv.ms/x/s!AncAhUkdErOkgqRwUEztHeWbj3LkqA?e=s4x0SI
A3 =IF(COUNTIF(C3:L3;"x")>0;ROW();"")
C1 =IF(COUNTIF(C3:C12;"x")>0;COLUMN();"")
B17 =IFERROR(INDEX($B$3:$B$12;MATCH(SMALL($A$3:$A$12;ROWS($A$3:A3));$A$3:$A$12;0));"")
C16 =IF(IFERROR(SMALL($C$1:$L$1;COLUMNS($C$1:C1));"")<>"";HLOOKUP(IFERROR(SMALL($C$1:$L$1;COLUMNS($C$1:C1));"");$C$1:$L$2;2);"")
C17 =IF(IFNA(INDEX($C$3:$L$12;MATCH($B17;$B$3:$B$12;0);MATCH(C$16;$C$2:$L$2;0));"")=0;"";IFNA(INDEX($C$3:$L$12;MATCH($B17;$B$3:$B$12;0);MATCH(C$16;$C$2:$L$2;0));""))

Hour calculation based on date excel

I've got a question where I don't know were to start to be honest.
I want to add a function to my sheet where I calculate the total amount of hours based on the date.
So as for my example I want excel to recognize the different dates, regardless of their position, and calculate the amount of hours spent on that date.
Is that something that is even possible?
Or is it impossible and is that the reason why I can't find anything about it?
little note: I'm using excel 2016
29-06-2021 update
got it working with both SUMIFS and SUMIF using the following formula:
=SOMMEN.ALS(B234:B332; A234:A332;"28-06-21")
the current challenge I'm facing is that I want excel to look up the date and determine the day
I already tried with VLOOKUP (with a calendar on another sheet) but that doesn't seem to work
Excel has to use the date in the date column to determine which day it is so I can determine the amount of hours per weekday.
example VLOOKUP
Obviously I'm doing something wrong, but I don't know what
I got it running with specifying multiple criteria in the SUMIF function
I now use the following formula for Mondays which basically is a list of all Mondays in a year
=SOM(SOM.ALS(A218:A316;{"04-01-21”;”11-01-21”;”18-01-21”;”25-01-21”;”01-02-21”;”08-02-21”;”15-02-21”;”22-02-21”;”01-03-21”;”08-03-21”;”15-03-21”;”22-03-21”;”29-03-21”;”05-04-21”;”12-04-21”;”19-04-21”;”26-04-21”;”03-05-21”;”10-05-21";"17-05-21";"24-05-21";"31-05-21";"07-06-21";"14-06-21";"21-06-21";"28-06-21";"05-07-21";"12-07-21";"19-07-21";"26-07-21";"02-08-21";"09-08-21";"16-08-21";"23-08-21";"30-08-21";"06-09-21";"13-09-21";"20-09-21";"27-09-21";"04-10-21";"11-10-21";"18-10-21";"25-10-21";"01-11-21";"08-11-21";"15-11-21";"22-11-21";"29-11-21";"06-12-21";"13-12-21";"20-12-21";"27-12-21"};B218:B316))
SOM=SUM and SOM.ALS=SUMIF in English versions
This works for me, it just takes some time to get all the dates in the formula.

Filtering or Importing data for specific date

I was wondering if anyone knows if it's possible to import a data, in a sort of a COUNTIF function but only for the data dated today?
I have 2 sheets, Attendance and Department.
In the Department tab, I have a list of employee's in column A. In column B and so on, I have a drop down option to select which department they're are stationed for each day. Each column represent a day, B being the 1st, C being 2nd, ... and so on. The header for each column has the day for the day as well.
On the attendance sheet, I have the list of Department in column A and in B, it is used to record how many employee are stationed at that department. I also have the day for the day on this sheet on A1.
Is it possible that when I change the date, the number of employee stationed in each department will change according to the date?
Is it possible to do this with just functions?
I've tried using the COUNTIF function, but I've found that I will have to change the range on a daily basis.
Use The Function: in B4 of Attendance Tab
=COUNTIF(INDIRECT("Department!" &ADDRESS(3,MATCH($A$1,Department!$A$2:$P$2,0)) & ":" &ADDRESS(6,MATCH($A$1,Department!$A$2:$P$2,0))),$A4)
Results: Attendance Tab
Department Tab:
I have used all the references as in the screenshots, you can change them if they are different in your sheet.
your question can be solved by SUMPRODUCT function. See below solution picture:
SOLUTION
Just to quickly explain my solution, I gave a name to the date on the Department sheet, called it 'Date_Lookup'; and I gave a name to the dates on the Attendance sheet, called it 'Date_List'. Names will simplify my formula especially when referencing across worksheets.
You will eventually find a lot of COUNIF scenario can be solved by SUMPRODUCT and this is just one example. SUMPRODUCT can do a lot IFs than COUNTIFS can do. In your case there are two criteria, one is which department did an employee attend to, and the other is on which date did the employee attend to that particular department. So my SUMPRODUCT formula can be understood as:
=SUMPRODUCT(('from the list of dates'='the particular date I want to see')*('from the full attendance record'='how many employees went to the given department'))
Let me know if you have difficulties understand my answer. A good 1 hour read through some online articles regarding SUMPRODUCT will help.
Cheers :)
Your first step would be to use a function to work out in which column the entered date appears. So in your Department sheet you enter a date in A1, then set B1 to:
=IFERROR(MATCH(A1, Attendance!2:2, 0), 0)
I use the IFERROR as I don't like seeing errors on my sheet. Assuming the result isn't zero, use a COUNTIF looking for the department letter in a range in the result column. I'd simply use on OFFSET to get the right range, but sticklers would tell you to find a different way of doing it. So long as your spreadsheet isn't going to increase in size to a massive complexity, OFFSET is fine.

Increment column based on date - Excel

I am trying to create an excel formula that will increment as the year changes. The following is what i am trying to do:
http://i58.tinypic.com/nbc1fc.jpg
I have 2 columns - date and id.
What i would like to do is increment the ID column by +1 when the year changes in the date column. So, dates from the same year will get the same id. (i am not concerned by the month/day values, all i need to do is assign the same id to dates from the same year).
I have tried a variety of formulas in excel but my excel skills are not great and i have been unable to find a solution. The best i could come up with is:
IF(YEAR(A1=1928),420) but that would be quite monotonous to do for every year in the excel file.
i did try to do a bit of research and the only similar question that i could find on here was this -->
Increment number when Date changes
Any help would be much appreciated
Please try, in say B2 assuming your data starts in A1:
=IF(YEAR(A2)=YEAR(A1),B1,B1+1)
and you have chose a value for B1. Copy down to suit.

Excel Advanced Filtering Issues - Advice Needed

So basically I have a main table, and I want to filter that data to another table (normally easy) but I want this based upon 2 criteria. e.g. I want to filter the data of a specific department but only for the current month. The way I display the current month in the main table is by inserting the date from a userform and then by formatting that cell to just display the month. However, when using advanced filter I use the column headings that I want to filter e.g. department: mens, month: november (worked out using =now() then formatting to just display the month) but when I'm running the filter it's not picking out the information at all.
I think this lies with the way the month is worked out and displayed but I can't figure out another way to do this. Any help is greatly appreciated.
I'm also open to trying a new method of just selecting data for the current month if anyone has a cleaner way, as I'm sure there is one.
You have to use a formula in your criteria to specify what month you want to extract. But it's not terribly intuitive. Take a look at this sample. My starting list is the range A1:B7. My criteria is in range D1:E2. The Department is straightforward; I just entered "3". (Obviously, without the quotes.) But instead of a Month criteria, I added "GetMonth" and entered the formula shown in the formula bar. You can name this whatever you want, but it can't be the same as one of the headers in your source list. (Yeah, I checked.) The formula checks to see if the current month of the date in cell B2 is 12, which is December, and returns TRUE or FALSE. You could use 11 for November. The advanced filter will apply the reference to cell B2 that's in the formula in a relative fashion to all cells in the Month column. And Viola! my output in range A10:B11 is what you'd expect it to be.

Resources