On column D i want TEXTJOIN of column C.
delimiter is comma with a space after: ", "
the two conditions that have to be met are: same date in column A, same value in column B
This is a table so I prefer using references of the name of the columns (for example "Date")
any help will be greatly appreciated
=IF($B1<>$B2,IFERROR(TEXTJOIN(",",0,$C2:INDEX($C2:$C$12,MATCH(1,--($B2:$B$12<>$B2),0)-1)),TEXTJOIN(",",0,$C2:$C$12)),"")
The Formula indexes column C from the current row up until it finds a different value in column B (minus 1).
The IFERROR is for the last found in range, because it will not find a value in the range after that value that doesn't match that value anymore. To be entered with ctrl+shift+enter for Excel versions prior to Office 365
You can use TEXTJOIN in conjunction with FILTER.
Something like: =TEXTJOIN(",",1, FILTER($C$2:$C$12, ($B$2:$B$12=B2)*($A$2:$A$12=A2))
Note you can replace the ranges with the named ranges, and that '*' is used as a sort of AND within the FILTER function.
EDIT: to avoid repeating rows, you can wrap the entire function with an IF statement that checks for duplicates. Something like:
=IFERROR(IF(MATCH(
TEXTJOIN(",",1,FILTER($C$2:$C$12,($B$2:$B$12=$B12)*($A$2:$A$12=$A12))),D$1:D11,0)>0,""),
TEXTJOIN(",",1,FILTER($C$2:$C$12,($B$2:$B$12=$B12)*($A$2:$A$12=$A12))))
Related
I got an issue with Xlookup formula for the lookup array & return array. As the 1st one I need to manually select the range for lookup and return array, I try to use Xlookup with multiple criteria to match with the keyword instead of only matching one criteria. However, the result was appear to be different. Please help how to adjust the formula to remove the manual selecting range. Thank you.
G column is text
AE column is number
J column is text
Z column is number
W column is date
=XLOOKUP(AE3,工作表2!$Z$2:$Z$6,工作表2!$W$2:$W$6,,1)
=XLOOKUP($G3&$AE3,工作表2!$J:$J&工作表2!$Z:$Z,工作表2!$W:$W,,1)
Your sheet names showing in Chinese may be confusing some people.
I'm not aware of any syntax in Excel that allows you to concatenate columns as part of an array definition. It would be great if we could do this. The only way I know to do this is with another column and then use that for your array. You could add $J2&$Z2 to another column and then use that. If you added that to column H your xlookup() would be:
=xlookup($G3&$AE3, $H2:$H6, $W2:$W6,,1)
Here's how it looks. I showed the xlookup() functions in F9 and F10 (right aligned) and the results in G9 and G10.
In this sheet, I have a range in B1:C18, where I want to return column C values in G column where all values match with column B with the condition value in E1.
But I'm getting only top value from the Column C but not all (i.e., Sep 2 has two values 443 and 472) but it is returning only 443.
Could anyone look at the formula return in G1 as
={IF(ISERROR(INDEX($B$1:$C$18,SMALL(IF($B$1:$B$18=$E$1,ROW($B$1:$B$18)),ROW(1:1)),2)),"",
INDEX($B$1:$C$18,SMALL(IF($B$1:$B$18=$E$1,ROW($B$1:$B$18)),ROW(1:1)),2))}.
Get the Answers in a column
Ok, I checked and your formula and it is correct too. I have modified it to be an ArrayFormula in the Google Sheets. Just check.
Formula 1
=ArrayFormula(IF(ISERROR(INDEX($B$1:$C$18,SMALL(IF($B$1:$B$18=$E$1,ROW($B$1:$B$18)),ROW(1:1)),2)),"", INDEX($B$1:$C$18,SMALL(IF($B$1:$B$18=$E$1,ROW($B$1:$B$18)),ROW(1:1)),2)))
You can try this formula too -
Formula 2
=ArrayFormula(IFERROR(INDEX($C$1:$C$18, SMALL(IF(E$1=$B$1:$B$18, ROW($C$1:$C$18),""), ROW())),""))
Just copy the formula in the cells of the respective column and you are good to go.
Get the Answers in a single cell
Use this Array Formula for your Google Sheets -
=ArrayFormula(TEXTJOIN(", ",TRUE,IF(B1:B18 = E1,C1:C18,"")))
It will aggregate all the values in a single cell.
Maybe you can try
=iferror(split(textjoin(", ", 1, filter(C2:C, B2:B=E1)), ", ", 1))
and see if that works ?
I want to concatenate the value of two columns in the current sheet and then result should be compared with the concatenation of two column value in another sheet.
e.g - The entered value in Column W and X in current sheet after concatenation should be compared with the existing value in column Y and column Z(after concat) of another sheet.
I have tried using the formula COUNTIF(Sheet2!CONCAT($W$2,$X$2:$Y$2,$Z$2),A2)>0 and some different alteration in this but it seems COUNTIF has range and criteria as argument and this is string which is causing error.
If you want to compare, a simple '=' will do.
Concatenation can be done using '&'.
in current sheet:
=W1&X1=Sheet2!Y1&Sheet2!Z1
will return TRUE if both concatenations are equal and FALSE if they are not.
To find the value W1&X1 in the entire range, I suggest you use a help column (unless you are willing to write a macro). In the help column of sheet1, you concatenate the values (=W1&X1 - drag down). In the hlep column of sheet2 you do the same. Then you make an additional column to check for matches, by using
=match(ValueHelpColSheet1,HelpColSheet2,0)
This formula returns the row number in which the match is found and an error when the corresponding value is not found. You can replace this error with something else using IFERROR if you want to.
I have 2 columns in my spreadsheet, both contains some numbers, column A has list of all numbers, and column B has some of the numbers from column A, now i want to highlight those numbers in column A, which are in column B here's my scenario:
Column A Column B
20301316 20322063
20302140 20322451
20307329 20326125
20307557 20334858
20314386 20371898
20314840 30368489
20322451 30384472
20326125 30384510
20334858 30384531
20371898 30384661
Here
20322451
20326125
20334858
20371898
should get highlighted. i used vlookup for this but for some reason it's highlighting all the numbers, here's the formula i used inside Conditional Formatting: (considering column A has values between A1:A10 and B has B1:B10)
=NOT(ISNA(VLOOKUP(B1, A1:B10, 1, 0)))
Could anyone please help me with proper formula.
Vlookup returns a value. In this context it is not the best formula to use, especially if you use it to return the value that you are looking up.
MATCH() is a much better fit for this scenario.
=MATCH(A1,$B$1:$B$10,0)
No fuffing around with ISNA() or wrapping in NOT() required. If it's a match it returns a number and will get formatted. If it's not a match, it won't get formatted.
It looks like you got the formula a bit backwards as it's looking in column A for values from column B. Try this instead:
=NOT(ISNA(VLOOKUP(A1,$B$1:$B$10,1,FALSE)))
Also, note that I made the lookup range an absolute reference by adding dollar signs.
Really though, I'd prefer a COUNTIF formula for this, just because I think it's more obvious:
=COUNTIF($B$1:$B$10,A1)>0
We have 11 columns (Columns B through L) of codes that I need to select based on a VLOOKUP from another sheet. IF ANY of the column values are "HI" or "EXT", I need to keep the record, if ALL of the column values are "M" I can exclude it. Column A is my LOOKUP list.
Right now the best I can come up with is 11 nested =IF(VLOOKUP(...) statements to set an inclusion flag, but if there's a way to SUM a TRUE/FALSE flag based on equality to the value "M" across all 11 columns...I've not had success finding that.
Any ideas?
This can be solved in two steps:
For columns B-L, the formula needs to be your VLookup formula (which you didn't put here) and ="M" at the end of it, which will result in a binary true/false value.
Then, in column M, simply do a logical AND using the AND function across B-L for each row e.g. =AND(B1:L1)
Another option, if you wish to keep the display format the same, is to do an array formula.
Enter =IF(AND(B1:L1="M"), "KEEP", "EXCLUDE"), then press CTRL+SHIFT+ENTER and it will add curly braces to it, meaning it calculates an array value. The resulting formula in the cell will be {=IF(AND(B1:L1="M"), "KEEP", "EXCLUDE")}. I tested, and it appeared to work as expected.