give value if number is in column - excel

I have 5 persons, each wih a personal code beginning with PI. I receive tasks with a 2 digit number. I need to assign these tasks on the basis of these numbers:
as you can see in the image, person pi299 has to get the tasks with the numbers in the column below. the number in this example is 70. this number changes every time. in this example the result should be pi20.
i've already tried multiple if statements with vlookup statements, but they all failed.
This will be part of a system that receives tasks and needs to assign them automaticaly according to the number. i need a formula that does this.

I believe the following formula will do what you expect, I've attempted to explicitly state the ranges, but these might require amending:
Range for Headers:$A$1:$E$1
Range for Data: $A$2:$E$500
Range for Number: $G$2
=INDEX($A$1:$E$1,SUMPRODUCT(MAX(($A$2:$E$500=$G$2)*(COLUMN($A$2:$E$500)))))

Related

Auto populate a table based from datas from another table

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.

Trying to find count of missed targets between 2 sheets

I am trying to work through this problem where I have 2 sheets (seen here as 2 sections for simplicity) and I am trying to count how many shipments from sheet 1 were below the SLA target in sheet 2.
The formula I tried was
IF(A21=INDEX(A2:A11,MATCH(A21,A2:A11,0),COUNTIF(C2:C11, ">="&C21))
I have tried multiple iterations of these parameters and have it returning some very inconsistent and totally wrong results. The output I am expecting is
0,0,1,3,0,0
I know this is going to probably be some kind of boolean algebra but I honestly do not understand how that system works. I have tried looking it up but I dont think i am doing it right.
Sample Data
You could use a simple boolean multiplier like this:
=SUM((A21=$A$2:$A$11)*($C$2:$C$11<C21))
This checks if the ID matches A21 and then multiplies these TRUE/FALSE results times a second boolean array that checks if the shipped amounts (C2:C11) are less than the SLA standard C21. NB: If it is really less than or equal, then use =SUM((A21=$A$2:$A$11)*($C$2:$C$11<=C21)). This generates a series of 1's for each value that matches the conditions and then SUM adds those one's up.
Using your example for ID Key 4/Item Name D, you would get:
SUM({FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE,FALSE,FALSE} * {TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE})
This gets coerced into:
SUM({0,0,0,0,0,1,1,1,0,0})

How to count cells with multiple criteria values within the cell

I've got a column showing an outcome (positive/negative), and the other column contains the reasons for that outcome in text format, looking something like this:
https://docs.google.com/spreadsheets/d/1bgZnZBGY_0iksANrsixRXRSNz0l9REYmJC29ZmygNjs/edit?usp=sharing
What I want to do is to group the reasons together and find the number of outcomes that contain at least one of those "reasons", as seen in columns G and H.
I've tried using =sum(countifs(C3:C9,{"Understands responsibility","Takes instruction well","Looks forward to work"})) for the first grouping, for example, but it only gives me the count for "Understands responsibility", but not the rest.
Using countif alone repeats the count of the outcome if multiple "reasons" in the groupings are under the outcome. (i.e. there's a double count if "Understands responsibility" and "Looks forward to work" are in the same cell for reasons)
Help would be appreciated, many thanks.
Try this in H3.. needs to be 'Control-Shift-Enter'ed:
=SUM(1*(MMULT(1*(TRANSPOSE(ROW(E3:E5))>0),1*ISNUMBER(SEARCH(E3:E5,TRANSPOSE(C3:C9))))>0))
This results in a "distinct count" per row. It can take a variable number of responses and reason groups; you can change 'E3:E5' in the 2 spots to point to your other groups.

automatic rota system based on special conditions

I am trying to create system for assigning tasks to a team using existing sequence. I have four separate columns:
Column A – Indicates the given sequence of operators
Column B – Indicates number of current tasks per operator (imported from another file by vlookup)
Column C – Indicates the name of the operator that was assigned to the last task (imported from another file by vlookup)
Column D – Indicates whether any of the operators are currently on holiday (check/uncheck check box (TRUE/FALSE logic)
I would like to automate the system so that the next operator that is due to receive tasks is displayed, however the operator must not have more than 4 tasks already assigned to him/her and must be present (not on holiday).
The selection process must repeat taking into consolidation the given sequence until the name is selected, hence if the last name in the sequence is not the exact match the system must start with the first name in the sequence.
Could someone be able to figure this out please as I am completely stock.
Currently, I have the following, column with the following =IF(B2<=4,A2,"N/A") and another column with the following =IF(E2=FALSE,F2,"N/A"). And one more column with =INDEX(SQESequence,MATCH(C2,SQESequence,0)+1,1), however that is not fully automated.
I think that I understand your problem / question and have come up with a solution. A more elegant formula solution may exist, will play with it more if I have time.
{=IFERROR(INDEX(INDIRECT("A"&MATCH(C2,A2:A5)+1&":A5"),MATCH(1,(INDIRECT("A"&MATCH(C2,A2:A5)+1&":A5")<>$C$2)*(INDIRECT("B"&MATCH(C2,A2:A5)+1&":B5")<4)*(INDIRECT("D"&MATCH(C2,A2:A5)+1&":D5")=FALSE),0)),INDEX($A$2:$A$5,MATCH(1,($A$2:$A$5<>$C$2)*($B$2:$B$5<4)*($D$2:$D$5=FALSE),0)))}
Enter CTRL SHIFT ENTER to set as an array formula, each function then returns an array of values rather than just a single value. You know you have set as an array formula when you see the { } 's
They say that a picture is worth 1000 words....so here are three!

Excel - find the biggest gap between numbers in rows

I have an excel file with >12500 rows in one column.
It contains such random strings with 20 digits:
2,3,4,6,7,8,12,13,14,24,30,42,45,46,48,50,56,58,**59**,61
1,2,6,8,11,12,13,16,17,21,24,27,28,33,34,42,44,48,58,61
3,7,10,13,14,15,18,21,23,24,25,29,30,34,37,48,51,56,57,60
8,11,13,16,17,19,21,27,29,35,36,39,42,44,46,50,53,54,57,60
2,4,7,9,21,26,28,30,32,34,35,37,38,39,43,44,50,60,61,62
10,13,15,18,21,22,23,24,25,26,40,42,48,49,51,52,56,**59**,61,62
1,2,4,7,14,15,18,20,24,29,30,32,35,41,42,50,52,55,58,62
1,4,8,9,10,12,17,24,25,33,37,41,43,44,46,49,52,**59**,61,62
1,2,4,6,9,12,15,17,21,24,30,31,32,36,41,44,47,48,51,58
2,7,10,12,15,16,20,24,25,27,30,33,39,44,45,52,54,55,58,60
5,7,10,11,20,22,24,31,32,33,36,38,39,41,43,47,50,52,56,58
3,6,8,9,14,15,19,21,25,28,34,37,39,45,47,54,55,56,57,**59**
1,2,3,4,5,8,14,15,18,20,23,31,33,37,42,45,46,51,52,55
I need to know whats the biggest gap between rows where a number hasn't repeated. For example - I search for any number (e.g 59) and I need to know what's the largest gap between two rows where number 59 hasn't repeated.
In this example it's 4 row gap between 59's.
Hope that I make myself clear.
Seems like a fun problem which admits a simple but not quite obvious answer. First -- make sure that the data is in 20 columns (use the text to columns feature under the data tab). Using your example, I came up with a spreadsheet that looks like:
V1 holds the target number. The formulas are in columns U.
In U1 I entered:
=IF(ISNA(MATCH($V$1,A1:T1,0)),1,0)
This formula uses MATCH to test if the value in V1 lies in the range to the left of it. If it doesn't the match function returns #N/A. The function ISNA checks for this error value. IF it is present, the overall formula returns 1 (since there are now 1 consecutive row without the target number) otherwise it returns 0.
The formula in U2 is similar with a little twist:
=IF(ISNA(MATCH($V$1,A2:T2,0)),1+U1,0)
The same basic logic -- but rather than returning 1 if the target number isn't present it adds 1 to the number above. The formula is then copied down the rest of the range. It has the effect of keeping a running total of consecutive rows without the target value. This running total is reset to 0 whenever a row with the target value is encountered.
The final ingredient requires no comment. In U14 I just have
=MAX(U1:U13)
which is the number you are looking for (assuming that the maximum number of consecutive rows without the target number is what you are looking for, even if this occurs either at the top or bottom of the data. If you want the largest gap that is literally between two rows where the number occurs, the logic would need to be made more complex).

Resources