Index Match formula issue with multiple criteria - excel

I have an issue with Index/match formula in Excel.
I have the following formula;
INDEX('[Master 2019-20.xlsx]SM'!$G$2:$G$5000,MATCH(1,('[Master 2019-20.xlsx]SM'!$M$2:$M$5000=$C2)*('[Master 2019-20.xlsx]SM'!C$2:$C$5000=$B2)*('[Master 2019-20.xlsx]SM'!$AE$2:$AE$5000=$A2),0))
Detail around the formula..
Index is column 'G' which is a list of reference numbers.
first match is from column 'M' which is a product description.
second match is from column 'C' which is the week number.
third match is a count column 'AE' which is looking for '1'.
This returns the value I require for that week if there is only one entry for that given week. the problem comes if there is more than one entry for that week? how can I show all reference's within a single week that meets the above criteria?
is there a way of populating a list that if the above criteria is met then it will show all associated references from column 'G'.
Any help with this would be appreciated. any other formula suggestions also welcome.
Thanks in advance.

Hereby a small example:
Formula in F2:
=IFERROR(INDEX(A$1:A$11,SMALL(IF((B$2:B$11="A")*(C$2:C$11<10),ROW(A$2:A$11)),ROW(1:1))),"")
So here I looked for values with the following criteria:
Value = A under header2
Value is less than 10 under header 3
Note1: It's an array formula and need to be confirmed through CtrlShiftEnter
Note2: If I made no copy paste errors, that would mean you need to use: =IFERROR(INDEX('[Master 2019-20.xlsx]SM'!G$1:G$5000,SMALL(IF(('[Master 2019-20.xlsx]SM'!$M$2:$M$5000=C$2)*('[Master 2019-20.xlsx]SM'!C$2:$C$5000=B$2)*('[Master 2019-20.xlsx]SM'!AE$2:AE$5000=A$2),ROW('[Master 2019-20.xlsx]SM'!G$2:G$5000)),ROW(1:1))),"")

Related

Is there any Excel function that can copy column's (first row's) name if the value matches?

I can't figure out a function that would automatically copy the first row value if the value on another rows matches 1. I would need the red dates to be automated.
Any advice would be very appreciated, thank you!
Excel problem
You can do it with
=INDIRECT(ADDRESS(1; MATCH(1;E2:ZZ2)+4))
The inner MATCH searched for "1" in the given array (from E2 to ZZ2). The "+4" is there, because you are beginning to search in column E (=5) and MATCH returns the column within your array.
The ADDRESS takes the first row and the column found by MATCH.
The INDIRECT returns the value of the given ADDRESS.
If you copy this formula down the rows, the search array (E2:ZZ2) is automatically adjusted to search the corresponding row.
=INDEX($E$1:$O$1;1;MATCH(1;E2:O2;0))
Replace semicolon with comma if your Excel version needs it.
If you have, you can also use Xlookup, it's a bit easier.
=XLOOKUP(1;E2:O2;$E$1:$O$1;"not found")

How can I get a column "bonded" with an INDEX function into a formula in Excel?

I currently have this table on Excel:
I have applied this formula to the last column, so that it matches the first and the second column:
=IF(ISNA(MATCH(A6;$B$1:$B$6;0));"";INDEX($A$1:$B$6;MATCH(A6;$B$1:$B$6;0);2))
How can I get the third column into the upper formula so that it appears next to the matching names? (The idea is that the second and the third column are bonded)
Like this:
Minor change:
=IF(ISNA(MATCH(A6;$B$1:$B$6;0));"";INDEX($A$1:$C$6;MATCH(A6;$B$1:$B$6;0);{2,3}))
Example at different address:
=IF(ISNA(MATCH(A21,$B$21:$B$26,0)),"",INDEX($A$21:$C$26,MATCH(A21,$B$21:$B$26,0),{2,3}))
In current versions of Excel, the 2nd column will SPILL. In older versions, you may need to select both columns and enter it as an array formula with ctrl+shift+enter
Instead of INDEX/MATCH this can be accomplished with FILTER/COUNTIF:
=FILTER(B1:C6,COUNTIF(A1:A6,B1:B6))
It filters the given range B1:C6 where COUNTIF(A1:A6,B1:B6) equals 1.
PS If you would want the list of non-matching values you can use the same but you could add =0: =FILTER(B1:C6,COUNTIF(A1:A6,B1:B6)=0)
Office365 is required for this solution.

Get list of rows with a second non-blank value and the column header for the second non-blank occurrence

I have an Excel sheet with data represented as below:
I need to get all the sites with a second non-blank column in the site's row (except Site, of course) and also get the Column Header value.
In the example, sites B, F and G have a second Y. So the result should be:
I am not very well versed with Excel Formulas, but I have experimented a bit with INDEX and I can find the second non-blank value itself. But I can't figure out a way to return the result I require.
Using the below formula I get as far as this, but still nowhere near my expected result.
{=INDEX(B2:I2,SMALL(IF(B2:I2<>"",COLUMN(B2:I2)-COLUMN(B2)+1),2))}
Edit:
With #Harun24HR 's answer I get this new result.
Try below formula.
=INDEX($B$1:$I$1,,SMALL(IF(($B$2:$I$11="Y")*($A$2:$A$11=C14)>0,COLUMN($B$2:$I$11),""),2)-1)
May need array entry with CTRL+SHIFT+ENTER.
Edit#: As per my below screenshot I have used below formulas.
For result column in J2 cell put
=IF(COUNTIF(B2:I2,"<>")>1,ROW(),"")
In C14 put
=IFERROR(INDEX($A$1:$A$11,SMALL($J$1:$J$11,ROW(1:1))),"")
And in D14 cell put below formula.
=INDEX($A$1:$I$1,MAX(($B$2:$I$11<>"")*($A$2:$A$11=C14)*(COLUMN($B$2:$I$11))))
Please note. You no need to array entry for these formulas.
Finally I ended up solving this using a combination of the accepted answer (by #Harun24HR) and How To Extract A Dynamic List From A Data Range Based On A Criteria Without Filters In Excel
In J2 through J11, I added the formula:
{=IFERROR(INDEX($B$1:$I$1,,SMALL(IF(($B$2:$I$11<>"")*($A$2:$A$11=A2)>0,COLUMN($B$2:$I$11),""),2)-1), "")}
In A15 to A24 (same number of rows as the original range), I added the formula:
{=IFERROR(INDEX($A$2:$A$11,SMALL(IF($J$2:$J$11<>"",ROW($A$2:$A$11)),ROW(1:1))-1,1),"")}
In B15 to B24, it's a simple VLOOKUP:
=IFERROR(VLOOKUP(A15,$A$2:$J$11,10,0),"")
This way, the result table is dynamic.

How to manually map columns in Excel with different headers

I want to write a function similar to simple Index-Match or Vlookup-Match.
Problem:
The values of the "Kadabra" columns should be shown in the "Jam" column and the "Shadabra" column in the "Jim" column. Given that the Columns will have consistent headers(Jim, Jam, Kadabra, Shadabra) but their positions may change(which means we cannot use column numbers).
"Abra" and "Jimmy" are the index values.
I'm looking for an excel formula solution. If there isn't one then a Visual Basic solution is also welcome.
One way to achieve this would be to use an Index Match Match formula as below, if you were to enter this formula into cell B8:
=INDEX($A$1:$C$4,MATCH(A8,$A$1:$A$4,0),MATCH("Kadabra",$1:$1,0))
And in C8:
=INDEX($A$1:$C$4,MATCH(A8,$A$1:$A$4,0),MATCH("Shadabra",$1:$1,0))
Then you could fill the formula down and it should bring the appropriate values into your Jimmy/Jim/Jam Table.
First please check below screenshot:
I have created a match table at E:F in order to avoid nested IFs for that condition. You may move the match table to another sheet and change your formula accordingly.
Formula for B8 is as below. You may drag-copy it down and right:
=VLOOKUP($A8,$A$2:$C$4,MATCH(VLOOKUP(B$7,$E:$F,2,0),$A$1:$C$1,0),0)

Excel Formula COUNTIFS and counting non-blank cells

I know this has been answered before, but I have tried the formulas suggested.
I am trying to count rows only if the first column has specific text (at least partial text) and the second column is NOT blank.
Here is my formula:
=SUM(SUMIF(A2:A33,"BA*",B2:B33)/SUM((COUNTIFS(A2:A33,"BA*",B2:B33,"<>"))*2))
My problem is that the rows where Column B is blank are still getting counted.
I have tried:
=SUM(SUMIF(A2:A33,"BA*",B2:B33)/SUM((COUNTIFS(A2:A33,"BA*",B2:B33,"<>"&""))*2))
Same results.
Evaluation shows:
=SUM(8/SUM((COUNTIFS(A2:A33,"BA*",B2:B33,"<>"&""))*2))
THEN:
=SUM(8/SUM((7)*2))
THEN:
=SUM(8/14)
Any ideas what I am doing wrong here?
Use
=COUNTIFS(A2:A33,"BA*",B2:B33,"<>")

Resources