How do I search one list of words in another showing matches? - arrays

Good morning,
I need to get the following:
I want to search for the following groups:
Grupo 1
Grupo 2
Of the following users:
enter image description here
And that gives me the following result:
enter image description here
Would it be possible to do this?
Thanks in advance

Using your provided example, (assuming you are on Excel 2019, 2021, or 365) in cell D2 and copied down:
=TEXTJOIN(" y ",TRUE,REPT({"Grupo 1","Grupo 2"},COUNTIF(C2,"*"&{"Grupo 1","Grupo 2"}&"*")))

This is an array solution under O365. It spills the entire result. On cell D1 put the following formula:
=LET(B, B2:B3, BYROW(B, LAMBDA(bb, LET(s, TEXTSPLIT(bb,", "),
TEXTJOIN(" y ",,XLOOKUP({"Grupo 1","Grupo 2"}, s, s,""))))))
Here is the output:

Related

facet_wrap: using x_free scale but having only 2 different x-axis with date

I performed on three sites in two different periods messurements. Now i want to show the results using facet_wrap. Here I want to have 2 columns (first line first period, secound line secound period) and each site in a row. To have only the respective dates in the respective graph, I use x_free, resulting in the desired graph. Now I would like to delete the X axis labels in the above graphs so that the date is only visible in the last graph.
My data looks like that:
enter image description here
My code for the plots is this one:
test_data$date <- as.Date(test_data$date )
Boxes <- ggplot(test_data, aes(date, number_bats)) +
geom_col(aes(date,number_bats)) +
facet_wrap(~Box, ncol = 2, scales = "free_x")
print(Boxes)
and the resulting graph looks like that:
enter image description here
How can I now delete the dates in the first two graphs, but keep it in the last one?
Thanks for your help!
I found this package "ggh4x" with an extended facet function (facet_grid2 and facet_wrap2) which solved my problem.

Excel formula to return a value if two values are true and one of two other things are true

I'm trying to write a formula in Excel where if value in B is “Eligible/Previously Eligible” and value in C is more than 365 days before today and value in D contains either 10 or 20, then return the value in A. I’ve been searching around and have written this:
=IFERROR(INDEX($A:$A,SMALL(IF((COUNTIFS($B:$B,"Eligible/Previously Eligible",$C:$C,"<"&TODAY()-365,$D:$D,{"*10*","*40*"})),ROW($A:$D)-MIN(ROW($A:$D))+1),ROW(A1)),COLUMN(A1)),"")
And have activated with the CTRL+Shift+Enter combo, but it just pulls in everything from A regardless of what is in B, C, or D:
#Solar Mike and #Scott Craner, thanks! This has gotten me closer but not quite there. I have a formula now that works to return the ID numbers that meet the criteria:
=IF(AND(B2="Eligible/Previously Eligible",D2<TODAY()-365,D2<>"",OR(SUM(COUNTIF(C2,{"*10*","*20*"})))),A2,"")
But I still can't get it to give me a list without white space. So, I can get what's in the "ID Numbers with Problems" column, but what do I need to write to get it to show the way I've done it manually in the "What I want" column?
image of what
Add a helper column:
=and(find("*elig",B2,1)>=1,now()-c2>=365,D2/10<=2)
Drag down to test each row. Then a results table based on those that give true.
Or use sumproduct() with column A to give the IDs.

Excel: Using a formula (no VBA) how to check if elements in a range are in another array which is defined by index/match

I'd have another question. The situation is as follows: I have two tables (=formatted Excel tables). The situation looks as below. I am trying to filter for the $ sales amount (cell E4) of a given sales rep (cell D4). I was thinking about using =SUMPRODUCT(IF((Table2[Store ID]=INDEX(Table1[Store ID],MATCH("Marc",Table1[Sales Rep],0),)),1,0)) (as I would have other conditions such as month which are no displayed in my example below), however, that's not giving me the correct value. The index-formula gives me just the first result once it finds "Marc".
The "correct" result in the example shown would be $121 as Marc accounts for these sales in the store with ID 1.
How can I overcome this problem? Any help would be much appreciated.
Add an additional column [shop ok] with a formula =IF(F7=$D$4,[#[store ID]],0) into Table1, to indicate that this store is under Marc's control.
In E4 insert a formula
=SUMPRODUCT(Table2[Sales]* COUNTIF(Table1[shop ok],Table2[Store ID]))
It's an array formula, so add it using Ctrl+Shift+Enter
didn't manage to avoid adding additional columns, got some errors, so ended up with this solution for now.
In E4, enter formula :
=SUMPRODUCT(SUMIFS(I7:I9,H7:H9,D7:D9)*(F7:F9=D4))

EXCEL: Create Array Formula out of INDEX/MATCH with multiple results

my aim is to convert a massive excel sheet with different projects, employees and hours worked per month into an overview per employee. It should be possible to display the projects the employee is involved in and how many hours he worked per project per month.
The original sheet looks something like this:
I managed to find the projects Person A worked in by filtering through the INDEX/MATCH function. I applied the formula to the whole row where the employees are listed and receive multiple results of projects. My question is how to transform the formula into something more effective to copy all of the matched results (projects) into a column (see 1).
This is what I have so far, if matches the employee name in a certain area; the output is the first match of the project he is involved in:
=INDEX(B2:J3;1;MATCH("Person A";Sheet1!B3:E3;0))
How can I copy this to the bottom cells to copy all of the matched results? Does it help to create an array formula with this?
You can use he following formula in cell B9:
=IFERROR(INDEX($2:$2,SMALL(IF($3:$3=$B$8,COLUMN($3:$3)-COLUMN(INDEX($3:$3,1,1))+1),ROWS(A$1:A1))),"")
It indexes row 2 and looks for the column number of the first match in row 3 that equals the value in B8 (=Person A). When dragging down it will look for the second match ROWS(A$1:A1) will become ROWS(A$1:A2) = 2.
For Person B you can use this formula in cell B14:
=IFERROR(INDEX($2:$2,SMALL(IF($3:$3=$B$13,COLUMN($3:$3)-COLUMN(INDEX($3:$3,1,1))+1),ROWS(A$1:A1))),"")
I hope this is what you where looking for.
PS
if you paste the following formula in cell C9 you will get the sum result for Person A on Project XY in month 10 2019:
=IF(OR($B9="",C$8=""),"",SUMPRODUCT(($B$2:$K$2=$B9)*($B$3:$K$3=$B$8)*($A$4:$A$6=C$8),B4:K6))
Note: That is provided that the value in cell C8 equals the value in cell A4.

Google Sheets formula: extend single item in arrayformula

For simplicity, let's say I have a raw tab with several values in several columns:
Raw tab
A B C D
Code Product Price Stock
01 Pen 1 yes
02 Pencil 0.8 no
03 Rubber 0.5 no
04 Paper 0.3 yes
Now, in another tab I want to filter data from the raw tab, but I want to be able to insert some fixed value to it. Look:
=filter({Raw!A:A,Raw!B:B,Raw!C:C},Raw!D:D="yes")
This works but I want to add a forth column with a fixed value, as if it was like below
=filter({Raw!A:A,Raw!B:B,Raw!C:C, "OK"},Raw!D:D="yes")
But this formula above fails with Function
ARRAY_ROW parameter 4 has mismatched row size. Expected: 601. Actual:
1.
I understand that "OK" is just a single item and is not expanded for all the matches from filter, but how to make it so?
or try:
=FILTER({RAW!A:C, RAW!X:X&"OK"}, RAW!D:D="yes")
where column X is an empty column
Or
=filter({Raw!A:A,Raw!B:B,Raw!C:C, if(Row(Raw!A:A),"OK")},Raw!D:D="yes")
use:
=QUERY(RAW!A:D, "select A,B,C,'OK' where D = 'yes' label 'OK'''", 0)

Resources