Textjoin: Using a unique ID, how do I concat multiple values? - excel-formula

I'm having trouble getting this to work. Basically, I have the following set of data:
In the TextJoin Formula column, I want it to do a look up against the adjacent ID, scan the income code column and concat the income codes pertaining to that unique ID, separated by a ','.
Many thanks

use:
=TEXTJOIN(",",TRUE,IF($A$2:$A$6=$A2,$B$2:$B$6,""))
Depending on one's version this may require Ctrl-Shift-Enter instead of Enter when exiting edit mode.
If one has the Dynamic Array Formula FILTER:
=TEXTJOIN(",",,FILTER(B:B,A:A=A2))

Related

Excel formula to use values from one table with comma separated values in another table

I am trying to use the values from Table 1 to populate Table 2 automatically but I am getting errors when I tried to use vlookup or the filter function. This is based on the fact that I am using full name (last name, first name). Is there a a better way to solve this problem?
Vlookup Formula: =VLOOKUP(G3,$A$3:$B$7,2,FALSE)
Filter Formula: =TEXTJOIN(", ",,FILTER(B:B,ISNUMBER(MATCH(A:A,FILTERXML(""&SUBSTITUTE(G3&", ",", ","")&"","//b"),0))))
Formula F3: =IFERROR(TEXTJOIN(CHAR(10);FALSE;VLOOKUP(TEXTSPLIT(E3;;CHAR(10);TRUE;1);$A$3:$B$7;2;FALSE));"")

Formula to Retrieve Multiple Column Numbers in Which a Value Appears

I am trying to use an on sheet formula that will provide me with all the column numbers in which a value exists. For the sake of example: I want to find all the columns on Sheet1 that have a value of ThisHeader in Row1.
I have been able to use the below formula to retrieve the result I want if the value I'm searching for only appears one time:
=MATCH("ThisHeader",1:1,0)
I'm unsure how to implement this same logic, but give me multiple column numbers if ThisHeader exists in multiple columns.
I'm not particular about how the result is displayed, although ideally I'd use something like: =SUBSTITUTE(ADDRESS(1,col_number,4),"1","") after the column numbers are retrieved in order to translate to a letter format. perhaps with a comma or dash separating each number/column letter. I could add or use multiple formulas and columns rather than a nested formula as well if that is the best or only route.
Thanks in advance!
If you have O365, you can use:
=AGGREGATE(15,6,1/($1:$1="ThisHeader")*COLUMN($1:$1),SEQUENCE(COUNTIF($1:$1,"ThisHeader")))
If you do not have the SEQUENCE function, you can replace it and use:
=AGGREGATE(15,6,1/($1:$1="ThisHeader")*COLUMN($1:$1),ROW(INDEX($A:$A,1):INDEX($A:$A,COUNTIF($1:$1,"ThisHeader"))))
Results
The formula returns an array of the column numbers. So, to visualize them if you don't have the dynamic array feature of recent Excel versions, you may have to enter this as an array formula (with ctrl+shift+enter over multiple cells. Or by using an INDEX function to return each element.

Return multiple comma separate values via lookup in Google sheets / Excel

I am looking for some help in creating a query in Google sheets that will look up a list of words (C2:C17) and see if those words appear in paragraphs of text in cells A2:A10. The result should see a comma separated list of words in column E and I'd like to be able to drag the query down through E2, E3, E4, etc.
Whilst it's ideal to do this in Googlesheets, i'd be happy with an Excel formula too.
Below is a sample spreadsheet to illustrate what I am trying to achieve.
Samlple sheet:
https://docs.google.com/spreadsheets/d/1DmafyX6xj7QRut5L2aTRMLGx0dhE-LKIgAcSpxE4OHs/edit?usp=sharing
In excel if one has TEXTJOIN in their version:
=TEXTJOIN(", ",TRUE,IF(ISNUMBER(SEARCH($C$2:$C$18,A2)),$C$2:$C$18,""))
Depending on version this may need to be entered with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
I think(untested) this for GoogleSheets:
=ARRAYFORMULA(TEXTJOIN(", ",TRUE,IF(ISNUMBER(SEARCH($C$2:$C$18,A2)),$C$2:$C$18,"")))

Excel concat function

I need a little bit of help. I'm trying to create a macro.
It's for hotel vacancies.
Column F2:F8 lists vacancy or occupied.
Column A2:A8 lists the room numbers.
I'm trying to create a macro that will list the room numbers in a different cell, if their corresponding room is vacant. I'm truly grateful for all your help!
=concat((a2:a8)If(f2:f8,"vacant"))???
use TEXTJOIN as it will allow the addition of a delimeter in an array form:
=TEXTJOIN(", ",TRUE,IF(F2:F8 = "vacant",A2:A8,""))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {} around the formula.

How to perform column to row operations in excel

Check out the selection in the top right, columns "Purchase/Sale" and "NOI".
I'd like to add these two columns and insert the sum for each period in their respective space. Is there I can link the sum of the columns and add the sum to the row?
In other words, I'd like the cells to link so I would have the following result:
Thank you
Use this array form of VLOOKUP wrapped in SUM():
=SUM(VLOOKUP("CF" & G1,$A$2:$C$7,{2,3},FALSE))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter when exiting edit mode instead of Enter. If done correctly then Excel will put {} around the formula.

Resources