Auto populate a table based from datas from another table - excel

this is the another version of my first question and I hope I can best explain my problem this time.
From the Table 1, I want to auto populate Table 2 based on this conditions and criteria (below)
From the example, I basically have 3 initial criteria, ON CALL, AVAILABLE, and BREAK
Now for the conditions, I want all Agents from status ON CALL, AVAILABLE, BREAK from Table 1 to be populated on Table 2 (optional: If possible, I wanted only to show agents that HAS a duration of 4 minutes and above from each status). My problem is I always refresh TABLE 1 so I can get an updated data. My goal here is to monitor our agents their current Status and Running Duration, and from that I only need to check on the table 2 so I would see right away who has the highest running duration from each status to be called out.
I only tried MAXIFS function but my problem with it, I can only show 1 result from each status.
What I wanted is to fully populate Table 2 from the data on Table 1. If this is possible with ROW function that would be great, because what I really wanted is a clean Table, and it should only load data if the criteria is met.
Thank you

Something you may be interested in doing is utilizing HSTACK. I am not sure how you are currently obtaining the Agents name in the adjacent column to the results but this would populate both the Agent along with the Duration.
=HSTACK(INDEX(A:C,MATCH(SORT(FILTER(C:C,(C:C>=TIMEVALUE("00:04:00"))*(B:B=H2),""),1,1),C:C,0),1),TEXT(SORT(FILTER(C:C,(C:C>=TIMEVALUE("00:04:00"))*(B:B=H2),""),1,1),"[h]:mm:ss"))
This formula checks Table 1 for any Agent with the status referenced in H2 (Available) that also has a time greater than or equal to 4 mins. It then sorts the results in ascending order and populates the Agent Name that is associated with it. It is dynamic and will produce a table like the following:
Just update the formula to check for "On Call" and "BreaK" as desired for the other two.
UPDATE:
As for conditional formatting, this is utilizing the custom formula posted in the comments. If the formatting of the times are of [h]:mm:ss then you would be looking to do something like this. Notice the 2 cells are highlighted for being between 4 mins and 5 mins.

This is an array solution that spill all the results at once. We use a user LAMBDA function GET to avoid repetition of the same calculation using as input parameter the status (s). The formula works for durations in time format or in text format with a minor modification. On cell E2 put the following formula for durations in time format:
=LET(GET, LAMBDA(s, FILTER(HSTACK(A:A, C:C), (B:B=s)
* IFERROR(C:C >= TIME(0,4,0), FALSE))),
IFERROR(HSTACK(GET("ON CALL"), GET("Available"), GET("Break")),""))
Here is the output:
For durations as text in hh:mm:ss format just replace: C:C >= TIME(0,4,0) with TIMEVALUE(C:C) >= TIME(0,4,0).
The GET function is reused to generate the result for each status. The last IFERROR call is used to remove #N/A values generated by HSTACK when the column doesn't have the maximum number of rows of the output.
The first IFERROR is used to treat the case when the value is not numeric, such has the header. This is because we are using the entire column as input range. Using entire columns produce more concise formulas with less maintenance effort, but it is less efficient, unless you have a good reason to have an open range. If you want to use a specific range instead for the data of the table, then you can remove it and update the ranges accordingly.

Related

Error in Excel with Time function within Match function

I am trying to use the Match function to return the row of an indicated table that a certain time value is on. The time is in mm:ss format on the table, so I want users to input the desired time to match as text for their simplicity (with data validation to ensure its correct format), and then use the Time function within the Match function to convert the input to match the format of the table for comparison. However, when using the Time function, the Match function returns the incorrect row, one row number short of what it should be to be precise. I attempted to do some debugging (shown below) and looked into the documentation of both the Time and Match functions, but can't figure out why this would happen. Is there something about the Time function I'm missing?
Here is a breakdown of what I'm using and what I've done to debug and figure out it's the Time function that's causing me issues. Column R has the functions I've been using and their results, and Column S has direct links to the table to show what the output should be. Column T shows that the time values are exactly the same but that using them yields different results in the Match function. Column U is the user input time in text format, and columns V through X are just used to ensure we get to the correct column in the lookup table.
(https://i.stack.imgur.com/ageCW.png)
Here is a snip of the table being referenced in the Match function.
(https://i.stack.imgur.com/FgfGG.png)
Well, this is curious. This is NOT a proper answer, but I needed to enter this as an answer rather than a comment because I needed the space and the markup of a table. I created my own table and ran my own experiment.
I entered the time value of 00:01:23 three different ways:
I typed "00:01:23" into a cell manually.
I entered =TIME(0,1,23) in a cell
I typed "00:01:15" and "00:01:16" into two consecutive cells, and then dragged it down and let Excel autofill.
Here's the results I got:
How Entered
Value
Typed "00:01:23" in Excel
0.0009606481481481480000
=TIME(0,1,23)
0.0009606481481481480000
Fill
0.0009606481481481490000
I emphasized the digit that turned out unexpectedly different.
I then did a MATCH(x,x,1) down this column for each value and it resulted in exactly the behavior you observed. The first two matched 1:22, as they should, because they were ever so slightly less than the table value. The self-referencing MATCH() of the 1:23 cell correctly matched on 1:23.
What is puzzling to me is that my test revealed to me that the value in the lookup table was a tiny bit off, by (0.0000000000000000010000), where your test presented the exact same number, concealing the difference. So in my test, the MATCH() behaved correctly for the data given, even if the data was wrong.
Excel is limited to 15 significant digits, and I have no way of knowing what rounding shenanigans Excel goes through to drop the remaining digits.
My thought goes to wondering how the time values in your lookup table were first created to begin with. Like, were they initially entered in a google sheet and then opened in excel? Is the 15 significant digit rounding handled identically among excel versions and OSes?

How do I recieve the number of cells based off of three columns in Excel?

I'm not too sure how to word this problem so, I apologize for the vagueness. Here is what I am trying to do though:
I have a large Excel table with a ton of values, I however, only care about 3 columns. The three columns I have are "Project Name", "Active/Planned", and "Week of Month". Here is an example of some values I would have:
Project Name
Active/Planned
Week of Month
StoreProj
Active
2021-07 Jul-Wk1
SecProj
Planned
2021-07 Jul-Wk2
StoreProj
Active
2021-07 Jul-Wk1
Now, I have used a formula to get the number of projects based on a specific week month and avoiding duplicate values for the project name. The code I used returns an integer of the number of projects. Here is what I used:
=IFERROR(ROWS(UNIQUE(FILTER(Table[Project Name],Table[Week of Month]=2021-07 Jul-Wk1))), 0)
This works as intended. Now the issue I am running into is that I need to filter through these rows as I did previously, but now I need to include the "Active/Planned" column. So, I want to be able to see how many projects I have based off of the week of the month and return a number of projects (excluding duplicate names), but be able to filter through that integer output based off of the active/planned projects. So in a perfect scenario I can choose the week of month and if the project is "Active" or "Planned" and see the amount of projects I have.
This might be an easy fix so I apologize, I am just stumped, any help would be greatly appreciated. Thanks!
Work through that step by step, you've got the FILTER function which is giving data to the UNIQUE function, to the ROWS function, and then your IFERROR. However, the data about whether each line/row is 'Active' or 'planned' isn't passed out beyond the FILTER function, so can't be used by anything further on in the above sequence.
Boring theoretical advice out the way, try this;
=COUNT(IF(UNIQUE(FILTER( Table[[Project Name]:[Active/Planned]], Table[Week of Month] = "2021-07 Jul-wk1"))= "Active", 1))
Explanation:
FILTER(...) outputs records with the relevant date filter, however it outputs Table[[Project Name]:[Active/Planned]] - both columns, to ensure all relevant data is there.
UNIQUE(...) Then narrows that down to unique values, although by this stage I'm not 100% sure you need this.
IF(... = "Active", 1) then replaces the 'Active' outputs with 1s
COUNT() returns the number of cells in the above that contain a number (the 1s from the IF())
Yes, you can't use COUNTIF on arrays (and all except that last bullet point above are outputting arrays not single values) - and no, I didn't know that before attempting to answer this question, found it over at a different question!

Multiple Date Comparison Queries

Is there an efficient way of identifying which date is the maximum date across 12 columns of data which all have different dates? Naturally the easiest approach is MAX(RANGE A: RANGE L) and then pull that value down to get the rest of the rows. However, this isn't what I want.
What I want to do is to create a function where I can compare the dates across rows and if it is the max - highlight that value. This is because each column is responsible for a specific part of a process and I want to identify where is the largest delay.
My initial thoughts were defining 2 variables and having them each hold one value temporarily and performing a check to see if var 1 > var 2. If it is, then move to the next one (FOR EACH) loop - otherwise max value is reached. Highlight that value.
Would anyone be able to assist me?

Time-Defined IF Statement Executed in Excel

I have a formula that I've been trying to setup to read a data value from the 4th row of a column IF the current time is less than a certain value, ELSE pull from the 2nd row of the column.
=IF($Z$16<5,'SOME TEXT'!N4,'SOME TEXT'!N2)
Formula for Current Time (Hour) in Cell $Z$16:
=TEXT(NOW(),"H")
The purpose of this IF statement is to account for using old temperature data until 5am, when the new data comes in. I thought that I had this formula set up but, for the past few mornings, it has not worked.
Use
=IF(<time-of-the-day><TIME(5,0,0),'SOME TEXT'!N4,'SOME TEXT'!N2)
You would replace <time-of-the-day> by any of
(NOW()-TODAY())
(NOW()-INT(NOW()))
TIME(HOUR(NOW()),MINUTE(NOW()),SECOND(NOW()))
TIMEVALUE(TEXT(NOW(),"H:M:S"))
There might be better options to isolate the current time of the day.

Using MIN function in excel when using mm:ss.00 fields and ignoring 00:00.00

Does anyone know how I can get excel to look at the following fields, all formatted in mm:ss.00 and return the lowest time. I am using this to calculate PB's - personal best times - in a sports club race sheet.
The formula I am using is
=MIN(J5,(U5),(AE5),(AO5),(AY5),(BI5),(BS5),(CC5),(CM5),(CW5),(DG5),(DQ5),(EA5),(EK5),(EU5))
The problem I have at the moment is that it is including 00:00.00 values in the cells and returning a MIN value of 00:00.00.
Any suggestions would be welcomed.
many thanks
Nigel
Use the following:
=SMALL((J5,U5,AE5,AO5,...),COUNTIF((J5,U5,AE5,AO5,...),0)+1)
COUNTIF counts the amounts of 0 (you maybe need to adjust this value based on your formatting, but it should work). SMALL returns the n-smallest number of the given matrix, with n being the counted value + 1.
Therefore if no 0 is in the matrix, you get the 1st-smallest (aka the smallest), with one 0 you get the 2nd-smallest and so on. Maybe you need to add a check if every value is 0, if that could happen, as in that case SMALL would try to retrieve the value on position list_size+1 of the list, which of course isn't present.

Resources