Excel Sheet: Count days a worker has worked - excel

I work in Sales and I have to count how many days has a worker worked. I currently struggle to come up with formula to count it.
My thought proces is that I made a column with all the workers in the company and in second colum I want to get amount of days they worked. From data via Countifs I can pull TOTAL of entries there are with their name but I can't filter it with function to get specific amount of days they worked.
Example 1 of Data per one person if filtered manually:
Example 2 of Data per multiple workers:
As you can see our data is giving me multiple entries with one name, so like "Joe" has a certain date multiple times in the Data but I only need to count it once so I get the "1" that he worked in that day.
I don't want to mess with the original data input, I'm putting it ofcourse in different sheet since the Data sheet is just where I get my information from.
I used this formula to get total amount of entries from data per worker.
=COUNTIF(Data_All[Worker],[#Worker])
And then I tried to appoint it to a single date and make a whole table just for one worker and it would give me entries per day.
=COUNTIFS(Data_All[Worker],Sheet1!F2,Data_All[Datum],$H2)
Here as an example it showed like "Joe has 9 entries on that specific date"
So in the end what I'm looking for is a way or formula to be able to filter it and be able to count days a worker has worked from all the data given.
I also apologize if its difficult to understand what I'm looking for but my English is not that good and I'm pretty novice in Excel and its formulas.
Thank you anyway for any response to my issue.

Use Pivot table. Put Worker on "row", Date on "value", then right click on any date in Pivot table and choose "Summarize value by" and choose "count". Now you can see if any value is insert more then one time for any Worker. Then just Filer worker and count how many rows are inserted. Grand total is counted.

Related

Pivot tables in excel - showing last values

I am having an issue with showing last value.
I have a source table, where is every single day (once) and for each day I have for item 1 total amount in stock.
I put it in pivot table. Column for total item in stock, for each day in month July for example, shows me balance for every day. When I group the month, it shows cumulative amount - which is wrong. I need to show last value.
Therefore I searched for a solution, I found on webpage ExcelJet this.
But when I tried it, for some reason, the date 31/07/2020 shows value 0 on top first, and on top second place the correct value for the last day of month.
Does anyone know why that happens? In source data there is 31/7/2020 with only 9.546.
You are applying the filter in the wrong field. You must apply it to your AMOUNT field, and you are applying it to your ITEM field (the field that holds the value VEL).
This is happening because you are working in the compact view of Pivot Table, and I think it's easier to work in tabular design.
Design the layout and format of a PivotTable
My Pivot Table is like this:
As you can see, ITEM and AMOUNT field are in the rows section. And DATE field in the Values section, set to MAX DATE and renamed as LATEST.
The filter is applied in the field AMOUNT.
I know what you mean, but actually the filter is applied on the correct field/row. See the prtscrn.
For the references, I attached the source table too.
btw, if I tried filtered out the column Note it still doesn't work properly

I am looking to delete rows in a table based on multiple filter criteria

I have been using Excel VBA for some time but am now looking to do something with the filters or similar.
I have a large table of data (in excess of 11000 rows) and I need to select up to 5 different criteria in a filter and basically delete each row which does not apply to this filter. (So effectively delete the invisible rows)
The filter needs to be set from an array of information in another listobject
The data in question is a list of staff members in departments set as a listobject - I need to only pull out whichever departments are selected from my criteria on another worksheet. The depts are Management, Warehouse, Stores, Admin, Transport. I need to delete all records which are NOT Warehouse, Stores or Admin
*I haven't really tried anything as I have been scouring the internet - I've had some thoughts aroung looping through the filter options
*Sorry - I have tried different things such as the for each row in table loop but this timed at over 15 minutes! (Apologies to the person who commented as I should've advised on this)
Sorry I have no code - barring "for each row in table" loop which I need to avoid using as this is a very slow process with this many records
Had no actual results - been using VBA for years but this is the first time I've been asked for this type of thing and I am at a loss.
Please be kind as I am new to the forum and obviously just looking for some help
Having trawled massive amounts of items I am sure there is an easier way but I have resolved this by converting the data back to a range, performaing the loop from the last to first row and deleting the row if the value is not found!
I'm happy with this as it now takes less than 15 seconds to complete - not sure why the list object was slowing it but I'm happy enough with it as is

Pulling Unique Values from Multiple Columns

So I'm working on automating my budgeting spreadsheets with a little automation. For each expense there is a category and then a description of the expense so for example:
What I want to do is on the far right for the total is tally up everything for each category, but I want to populate that list on the fly, so for the category column I want it to look at all the category columns and list out unique categories, so even though I might have 'Grocery' listed twice during the week, it only shows up once in the Total Section. The price column would then be the total of that category spent that week.
The issue I'm having is pulling unique values from multiple columns. The closest I've found is this:
=INDIRECT(TEXT(MIN(IF(($A$2:$C$9<>"")*(COUNTIF($E$1:E1,$A$2:$C$9)=0),ROW($2:$9)*100+COLUMN($A:$C),7^8)),"R0C00"),)&""
It works great if the columns I'm looking at are all next to each other, but the columns I'm using are split up. I can't seem to get it to work with the columns broken up.
My attempt:
=INDIRECT(TEXT(MIN(IF((($B$3:$B$35,$E$3:$E$35)<>"")*(COUNTIF($Q$2:Q2,($B$3:$B$35,$E$3:$E$35))=0),ROW($3:$35)*100+COLUMN($B:$B)+COLUMN($E:$E),7^8)),"R0C00"),)&""
All I get is 'Error in Value'
Any advice is greatly appreciated. Thanks!

Excel Query looking up multiple values for the same name and presenting averages

Apologies if this has been asked before. I would be surprised if it hasn't but I am just not hitting the correct syntax to search and get the answer.
I have a table of raw data for my staff, it contains data on the name of the employee who completed a job and the start and finish times, among other things. I have no unique ID's other than name, and I cant change that as I'm part of a large organisation and I have to make do with the data I'm given.
what I would like to do it present a table (Table 2) that shows the name of the employee and then takes the start/finish times for all of their jobs on table 1 and presents the average time taken across all of their jobs.
I have used Vlookup in the past but I'm not sure it will cut it here. the raw data table contains approx 6000 jobs each month.
On table 1 i work out the time taken for each job with this formula;
=IF(V6>R6,V6-R6,24-R6+V6) (R= started Time) (V= Completed Time) in 24hr clock.
I have gone this route as some jobs are started before midnight and completed afterwards. Although my raw data also contains dates (started/completed) in separate columns so I am open to an experts feedback on this and if there is a better way to work out the total time form start to completion.
I believe the easiest way to tackle this would be with a Pivot Table. Calculate the time taken for each Name and Job combination in Table 1; create a pivot table with the Name in the Row Labels and the Time in the Values -- change the Time Values to be an average instead of a sum:
Alternatively, you could create a unique list of names, perhaps with Data > Remove Duplicates and then use an =AVERAGEIF formula:
Thanks this give me the thread to pull on, I have unique names as its the persons full name, but ill try pivot tables to hopefully make it a little more future proof for other things to be reports on later.

Have VBA for Unique items in multicolumn range, how to filter multiple rows on previous results?

Intro
I'm trying to enhance a basic planning sheet (see below) with additional sorting.
The first column lists the resources. Each week has 2 columns representing 20 hours per column.
Example readout;
In week 30 Aron works 40h on project A. In week 31 he works 20h on project A and 20h on project B.
Jeff does not work in WK30 and works 40 on project C in WK31
My Goal
Generate a unique list of projects over the weeks
Be able to filter based on project name and get only the rows of the resources working on that project. (No specific need to filter out the other projects in the same row. So if I filter on project "A", I want to only see the rows of Aron and Dave)
What I have
Basically item 1 is covered as follows:
The 2nd column (Projects) is an array-formula generated by a VBA function (taken from here) that returns all unique items in a multi column range. The cell formula looks like this, where the second argument of UniqueItems() determines if we only return the number of unique items (TRUE) or a list of all unique values (FALSE).
=TRANSPOSE(UniqueItems($C$4:$H$6,FALSE))
What is missing
Item 2 of my goal list is missing. If I currently select the filter option for Projects (see screenshot)
and filter on Project A, then I only get row 5 and not also row 4.
How would I go about filtering this properly?
VBA code is allowed or pointers to which regular formula functions I should use. A complete different solution with the same results is also fine. I thought about pivot tables, but I think it cannot handle empty cells around the range which is common if there's no work for that resource.
The sheet used can be downloaded from here
IMHO, you will be much better off creating a worksheet serving as a normalized database table with one row per the following columns: person, week, project. Lastly, a final column for the number of hours (and optionally, a cost for those hours customized per worker as needed)
Then use a pivot table to build the view you posted (or any other reporting view you need).
This will let you create multiple pivot tables that easily answer questions like:
how many hours are planned for project X in total? by a certain date?
how many total hours are planned for each worker per time period - who is over/under utilized?
how many total hours are planned for each worker per project?
etc.
Keeping the data separate from the reports is safer, and more modular - I wouldn't want a VBA bug to have the potential of corrupting/deleting raw data.

Resources