excel sumproduct formula calculating time - excel

hello dear forum members and admins,
i created a dashboard to calculate customer numbers based on raw data prepared on day and time set.
there is no problem here I can calculate. but I also want to calculate the monthly average customer numbers based on the time set. for this purpose, I created a data table in a daily_pax_sheet. for e.g in January between 10:00 - 10:30 CUSTOMERS E totally number is 35 and this 35 amount occurred in 8 days, then it calculates 4 amounts. in daily_pax_details sheet row 107 formula firstly calculate sum of the data then it divides the day number (for e.g this amount occurs in 8 days) but in some cases, raw data include more than 20k line and it's calculating and waiting too much. is there any other way to do it in a quick way ? how can I change this formula to make calculation quick ?
https://docs.google.com/spreadsheets/d/1y-2Ke2ssskzSM-wYszU54CIEraPbEX4X/edit#gid=459027650
UPDATE: thanks for the idea and solution from members
I also realized another solution and I think it will help other people in the future. we can get the data to the pivot table with counting the unique values with changing field settings. To do it you should get the data pivot table with selecting "add this data to the data model". then changing value field settings with the "Distinct value". hope it will help another pppl.

Your SUMIFS formulas use whole columns as criteria, so every calculation checks more than 1 million cells. And because you use more than 1 column, then every time you update *anything in the file, Excel checks more than 4 million cells because of your formulas...
I changed all to use the righ rawdata range of cells used, not whole columns. And now it works perfect.
As example, your formula is:
=SUMIFS('raw data'!$R:$R;'raw data'!$D:$D;'Daily customer'!C$3;'raw data'!$I:$I;'Daily customer'!$A4)
And I changed to:
=SUMIFS('raw data'!$R$2:$R$2461;'raw data'!$D$2:$D$2461;'Daily customer'!C$3;'raw data'!$I$2:$I$2461;'Daily customer'!$A4)
Because in your sheet raw data your data goes from row 2 to 2461, so in every calculation Excel checks only 2460 cells, not 1 million....
Change all your formulas like this and you should notice a better performance indeed.
UPDATE: I've uploaded the modified file: https://docs.google.com/spreadsheets/d/11isonBHFJTFFWtZTJg66JHbtyrD0XFGl/edit?usp=sharing&ouid=114417674018837700466&rtpof=true&sd=true
It works smoothly for me. No lag or anything. I can change any cell value, move the graph, filter cells and everything is done almost instantly.

Related

SUM of time... how can I get an answer that isn't 00:00:00?

I'm creating a report for work for monthly stats and, as part of this, I have to calculate the total sign-on time for the team. I have created an individual sheet for each person to sum or average the various different stats.
I've created a table within the sheet and added a Totals Row. I want to SUM the total sign on time. I've set the Totals Row field to SUM, but the answer comes back with 00:00:00. I am copying data from a system generated spreadsheet, but I'm pasting the data as "Value Only", not including the formatting.
Is there something I'm doing wrong? Or something I'm just not aware of?
When I enter the data manually it gives the correct result, but this is too time consuming to be practical.
Thank you.
Not much context here and is hard to understand your question.
If you paste values only of a Time eg 08:30 (Eight and a Half hours), the result is displayed as a decimal like so:
When you paste your Values in, set the format to "h:mm"
You can then use the SUM function and set the format of the cell as "[h]:mm;#" within custom formatting.
This shows the result as a continuous sum in 24 hour format
see example bellow
Each Totals formula is the following, only the format changes - "=SUM(Range)"
I hope this helps but without any more context, we cant help.
Thanks

How to filter in excel between two time intervals (not dates)

I have report in Excel containg incident tickets and their creation time. My task is to filter them based based on whether they are in BH, OOH or Weekends. Starting BH are from 7 AM to 7 PM, OOH are from 7 PM to 7 AM.
Data is located in cell B, and formated as "3/1/2018 12:27:37 AM "
Cell B is formated as Date, not text.
My goal is to perform this WITHOUT changing the overal structure of the report, (without helper column), but instead to use "between" filter or some other date filter.
Searching the web i found many solutions with helper column, advanced filter, using MOD or Hour, but i am unable to implement them to work.All i keep getting is blank output
Any help or guidance will be much appreciated
Sample Image of the table
- 25k+ rows formated like this starting from 1st Mar 2018, ending at ending at 31st of May 2018
Desired Output
- Goal is to present chart showing how many tickets are logged in BH, OOH, and Weekends, in a similar way.
Sample table : https://drive.google.com/file/d/1FSy_XWfpInWRXKK8Y_Qx032NpZav7k5e/view?usp=sharing
To set up the advanced filter, insert some rows at the top of your graph, and then enter your formulas for the various conditions.
For example, for the OOH filter (edited to be consistent with the counting formula):
I have inserted enough rows so that the first row of your data is Row 8, and B8 is the first timestamp.
I have also assumed that you want to exclude weekends for the OOH filter.
Given this as a basis, you can construct other filter criteria ranges for your other requirements.
Note that the "Header" in row 1 is merely for convenience and can be blank. When using formula critera, a requirement is that this header NOT be the same as any column header.
But, if your goal is to just get a graph of the number of entries for the different time statuses, you could just use a formula.
I converted your data to a Table so as not to worry about range references. I find that extraordinarily helpful, both in understanding the formula, and also in creating dynamic range references which will adjust automatically as data is added or deleted from a table.
BH: =SUMPRODUCT((HOUR(Table1[Opened])>=7)*(HOUR(Table1[Opened])<=19)*(WEEKDAY(Table1[Opened],2)<6))
OOH: =SUMPRODUCT(((HOUR(Table1[Opened])>19)+(HOUR(Table1[Opened])<7))*(WEEKDAY(Table1[Opened],2)<6))
Weekend: =SUMPRODUCT(--(WEEKDAY(Table1[Opened],2)>=6))
Or, with regular addressing:

Excel - Take Average of Monthly Data

I have a historical data set for commodity pricing. Throughout the data set, the data starts inputting prices on specific days, rather than the average of the entire month. In order to keep the flow of having only the average pricing for the months.
In the best case scenario, I would use an Averageif function, however, the data for each month doesn't display a consistent amount of days.
How can I automate this the process: If the month is the same as the previous row and different than the next row, calculate the average of the ^ rows until you hit the next month.
Here's a simple display of what I mean:
]1
You can use a pivot table to get the output you want. It will also be neatly organized instead of having your averages mixed in with a mostly blank column. Photo below shows the set-up/output of a pivot table generated with random data.
For a solution without pivot tables, you can use the following formula :
=AVERAGEIFS($B$1:$B$30;$A$1:$A$30;">="&(A1-DAY(A1)+1);$A$1:$A$30;"<="&EOMONTH(A1;0))
The above example is from cell C1, and can be copied down the entire list. The dates are in $A$1:$A$30 and the values in $B$1:$B$30. The first conditions test on the first day of the month (calculated as A1-DAY(A1)+1),and the second condition as last day of the month (calculated as EOMONTH(A1;0)
This will obviously put the average value of the month on each row, but will also work if your data is not sorted on date. If this is the case, and you only want to display one number per month in the column (as in your own example), you can add an additional IF statement wrapped around the formula:
=IF(EOMONTH(A2;0)=EOMONTH(A1;0);"";AVERAGEIFS($B$1:$B$30;$A$1:$A$30;">="&(A1-DAY(A1)+1);$A$1:$A$30;"<="&EOMONTH(A1;0)))
So it will display empty in all cells, except where the month changes.

Excel - Checking Values of Cells Across Sheet

I have a spreadsheet that provides monthly results for the last year. The layout is 7 columns per month, each column is the same information for each month (count and rate of various things).
I need to trigger a true/false based on both count and rate being above threshold values in any of the twelve months.
I can do this using either nested IFs or just a lot of IF statements, but was wondering if anyone has a better suggestion? I am open to formulas or VBA, whatever would be most robust.
Image of how each month is arranged
It's a little hard to tell from your spreadsheet what the layout is, but I tried to recreate it (See image below). I entered the function =IF(OR(B2>0.04,C2>2),$A$2) into cell A7 and dragged it across the spreadsheet. All the values you're looking for should be under the Month column. To prevent the function from changing its reference to the first column Name, I used absolute referencing, with dollar symbols $A$2. This way you don't have to keep changing it back to the specified column. Hope this helps.

Excel: Multiple Vlookups to pull in 1 data element

I have 2 separate sheets in Excel. On sheet 1, I am using the following if statement in column C (hours) to pull in a number in column D (hours) from sheet 2.
=IF(ISERROR(VLOOKUP(A2,Sheet2!A:D,1,FALSE)),"N/A",VLOOKUP(B2,Sheet2!A:D,4,FALSE))
The first vlookup is validating the project number on the second sheet, then the second vlookup is validating the team name and pulling in the hours from the second sheet.
The problem is that when I copy the formula down the column, the hours value repeats for the same team name. Does anyone have any suggestions?
Sheet 1
columns
Proj_Number Team Name Hours
123456 R&D 26
123456 Dev 50
123456 QA 10
777777 R&D 26
Sheet 2
Proj_Number Team Name Organization Hours
777777 R&D AUTO 26
123456 DEV AUTO 50
123456 QA AUTO 10
123456 R&D AUTO 20
You are asking VLOOKUP to do something that it cannot do. The second VLOOKUP in your IF formula:
VLOOKUP(B2,Sheet2!A:D,4,FALSE)
is being asked to return the first instance of 'Team Name' that it finds on sheet 2; which it is doing.
If you want to return the number of hours based on the 'Team Name' and 'Proj_Number', you need to do it a bit differently.
One way is to create another column on Sheet2, maybe called 'Proj_plus_Team', (inserted at column C location) that concatenates the values in 'Proj_Number' and 'Team Name'. Then you can search on this new column using the following formula:
VLOOKUP(A2 & B2,Sheet2!C:E,3,FALSE)
Also, when doing this, make sure that the data on Sheet2 is sorted alphabetically on the values in column 'Proj_plus_Team'. VLOOKUP requires that the search column be sorted alphabetically or inaccurate results may be returned.
Option 1 - using formulas
LOOKUP is designed to retrieve a single value, which is what it's doing. It loops through a data range, checking whether the value is bigger/smaller than the reference value, and retrieves the first transition point. In your case, it finds the first match and stops, not what you're after at all.
If you want to do this using formulas, you'll probably find SUMIF() and the newly added in 2007 SUMIFS() to be a much cleaner route. Also, side-note, in Excel 2007 Tables are your new best friend, they tidy the formulas for this kind of thing right up and look after things like expanding ranges.
Your example above, using tables, would be translated to:
=SUMIF(Table2[Team],Table1[[#This Row],[Team]],Table2[Hours])
where Table1 is the equivalent of your Sheet1, and Table2 maps to Sheet2
Of course the reason that this won't provide what you're after is that this is summarising by team only, whereas you want to apply 2 filters, so you'd move to SUMIFS() and end up with:
=SUMIFS(Table2[Hours],Table2[Proj_Number],Table1[[#This Row],[Proj_Number]],Table2[Team],Table1[[#This Row],[Team]])
The benefit is that your formula will always recalculate automatically, the downside is that you have to manually update your Table1.
Option 2 - pivot tables
Insert --> Pivot table will create your pivot table, set the range as appropriate.
Then drag Project Number into Row labels, drag Team name below it also in Row labels, and drag Hours into the Values box.
That'll give you a breakdown by project by team of how many hours. You can then mess around with the options to get it exactly how you want, by doing things like turning off the level 1 summaries. Those kind of options are best found by experimentation, they live in the PivotTable Design tab. The catch is the need to manually refresh the pivot table, the benefit is that when you add new projects they'll be taken care of easily.

Resources