Search and combine multiple values from an array - excel

There is a data set with cells containing multiple values.
I need to cross check each cell in the dataset with a predetermined list of values and return all matching values in one cell per row.
The best option would be to use TEXTJOIN function but it doesn't work in my Excel 2016. Here is the alternative code I tried to make but it returns only the first value in the array.
{=IF(SUMPRODUCT(--ISNUMBER(SEARCH(list,A2))), IF(ISNUMBER(SEARCH(list,A2)), list, ""), "")}
Will greatly appreciate any help!

The same has been answered through comments by Scott Craner, hence the same is in unanswered history. Behalf of Scott posting answer here which have accepted by question owner.
Your TEXTJOIN Formula would be =TEXTJOIN(", ",TRUE,IF(ISNUMBER(SEARCH(list,A2)),list,"")) entered as an array formula with Ctrl+Shift+Enter. Put the code from the first link in a module attached to the workbook and use the formula

Related

Use of Excel formula 'IF" and "AND" with multiple sheet to combine the data

I have two excel datasheets i.e. 'Data' and 'Sheet1'. Now, I am using the following excel formula to bring some data from 'Sheet1' to 'Data':
=IF(AND(Data!B2=Sheet1!A2,Data!C2="Argentina"),Data!AU2:CR2=Sheet1!B2:AY2,NAN)
The formula return "#NAME?".
Can you help solve this issue? Thanks in advance.
You no need to mention destination sheet cells in formula. If function doesn't accept this. Try below formula
=IF(AND(Data!B2=Sheet1!A2,Data!C2="Argentina"),Sheet1!B2,"NAN")
This is advise too large to fit into a comment:
In order to solve such an issue, you can use Formula auditing: it gets into your formula and solves it step by step.
After some evaluations, I get the question to evaluate this formula:
=IF(FALSE, Data!AU2:CR2=Sheet1!B2:AY2, NAN)
And the moment it wants to evaluate Data!AU2:CR2=Sheet1!B2:AY2, I get an error.
I tried to put this formula excerpt as a single formula into a sheet, and as a result I got a complete row, filled with boolean values (which does not fit into one single cell, explaining the problem).
What are you trying to do here? Do you want every single value to be equal? Do you want matches? ...

Excel Sumifs with multiple arrays referenced on another cell

I have a formula that sums one column based on a criteria from another column. This formula works fine:
=SUM(SUMIFS(sheet1!C:C,sheet1!A:A,{1, 7}))
However, i need to be able to use a cell reference which will contain the {1, 7}
So the formula will look like this:
=SUM(SUMIFS(sheet1!C:C,sheet1!A:A,M2))
But this returns a zero, when evaluting the formula it pulls the contents from the cell but wraps it in "" which i think is where the issue is happening.
I've tried adding formula to remove the quotes, and trying to pull the contents differently, but still the same.
Any help would be greatly appreciated.
Figured out a way round this.
I created a named range called condition, and assigned =Evaluate($M2).
Then I used this formula =SUMPRODUCT(SUMIFS(sheet1!C:C,sheet1!A:A,Condition))
This picks up all numbers used in M2, and works on all rows below with the Evaluate formula following.
Thank you to everyone that assisted with this.
This link helped aswell: Excel SUM of SUMIF/SUMIFS with dynamic multiple criteria

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.

Excel how to SUMIF with multiple criterias in Range of Column

Above picture is just a simple Files that I created, My original file is complicated and has a range of numbers in Criteria field.
NOTE: I just want only one Formula to get final Answers, not many Formulas then sum again those lines. (Using EXCEL)
Thanks and appriciate
p/s: Sorry for my rip English
Your formula in the upper right is close. You can use:
=SUM(SUMIF(C3:C23,K5:K10,D3:D23))
However, this in an array formula, so you must confirm this formula with CTRL+SHIFT+ENTER for it to work properly
And if you don't want to have a range that contains your criteria, you can list it right in the formula like this:
=SUM(SUMIF(C3:C23,{20,22,24,25,26,28},D3:D23))
(Same thing - must confirm with CTRL+SHIFT+ENTER)

Excel Nesting IF in SumIfs

Ok. So i'm looking to nest IF in my SUMIFS formulas. The only problem i'm having is when one of my referenced cells show FALSE, the formula no longer works. How do i get the formula to completely remove that Criteria from the SUMIFS formula and still work?
Codes i've used.
=SUMIFS(R:R,IF(BE4=TRUE,I:I),IF(BE4=TRUE,BD4),J:J,BD5)
=IF(BE4=TRUE,SUMIFS(R:R,I:I,BD4),0)+IF(BE5=TRUE,SUMIFS(R:R,J:J,BD5),0)
I've even tried breaking the SUMIFS formula into multiple cells, and using IF and INDIRECT to create a working code. Just keeps popping up with #REF error.
Here's that code
=INDIRECT(CONCATENATE(BK1,IF(BE2=TRUE,BK2,""),IF(BE3=TRUE,BK3,""),IF(BE4=TRUE,BK4,""),IF(BE5=TRUE,BK5,""),BK6))
Here's the code that didn't work before the IF.
=INDIRECT(CONCATENATE(BK1,BK2,BK3,BK4,BK5,BK6))
Any help would be greatly appreciated.
Thank you
Mock Sheet
https://www.dropbox.com/s/tl64vbsalcqxqdm/CriteriaIFS.xlsx?dl=0
Try this formula:
=SUMIFS(BK1:BK6,BK1:BK6,">=0")
Please try this formula,
=IF(BE4=TRUE,SUMIFS(R:R,I:I,BD4,J:J,BD5),SUMIFS(R:R,J:J,BD5))
Your formula
=SUMIFS(R:R,IF(BE4=TRUE,I:I),IF(BE4=TRUE,BD4),J:J,BD5)
You are saying:
Sum from column R everything if match in J with BD5 and IF BE4 is TRUE THEN in I IF match with BD5. Well, the error is because, if BE4 is true is returning a string not a range. Instead you could use this:
=SUMIFS(R:R,INDIRECT(IF(BE4=TRUE,I:I)),INDIRECT(IF(BE4=TRUE,BD4)),J:J,BD5)
And it will be ok, until BE4 is FALSE. because the INDIRECT function return an #REF!... and will be a mess.
I'm not sure if I get the whole idea, but please tell me if you need an emprovement.
Edit #1
Reading your comments I think this could help:
=IF(BE4=TRUE,SUMIFS(R:R,I:I,BD4),0)+IF(BE4=TRUE,SUMIFS(R:R,J:J,BD5))
Try to post some dummie database (using text table format) to give you a better help... and remember to read this: How to ask because your question is to vague, and it was necesary to many comments and answers to "guess" what you really want.
Try this array formula:
=SUMIFS(N:N,IF($A$2,E:E,T:T),IF($A$2,$C$2,""),IF($A$3,F:F,T:T),IF($A$3,$C$3,""),IF($A$4,H:H,T:T),IF($A$4,$C$4,""),IF($A$5,I:I,T:T),IF($A$5,$C$5,""))
It is an array formula and must be confirmed with Ctrl-Shift-Enter.
This is based on your data sheet provided. You will need to change the references to your sheet. The column T reference should be a column that is empty.
I needed to do the same thing. The formula needed to look at a different column as Criteria_Range2 depending on product. I put an IF statement for both the Criteria_Range2, and for the Criteria2 because each column had slightly different information. Basically, it tells the formula use column C (in another worksheet) as the Criteria_Range2 if the product category is anything other than Ceilings. If it is Ceilings, it uses column A as Criteria_Range2. On my worksheet, Column A is a "helper column" that groups our Ceilings sub-products into Tile and Grid.
Hopefully this isn't too confusing, but it works for me and I didn't easily find anything else out there showing how to use IF statements in the Criteria Ranges in the SUMIFS. (I suggest ignoring the very ugly xlookup defining the sum_range.)
SUMIFS(XLOOKUP($AF$20&"COGS CM MTD",Fact_Sales!$E$6:$CS$6&Fact_Sales!$E$7:$CS$7,Fact_Sales!$E$8:$CS$928),Fact_Sales!$B$8:$B$928,'Report Draft'!$AE27,IF('Report Draft'!$AD27<>"CEILINGS",Fact_Sales!$C$8:$C$928,Fact_Sales!$A$8:$A$928),IF('Report Draft'!$AD27<>"CEILINGS",'Report Draft'!$AD27,'Report Draft'!$AF27))

Resources