I have a worksheet consist of multiple Item Templates (Note that 1 template have different values) in in Column A and the item attributes in Column B to Column GD, I want to get the value of "NULL" per item template from Column B:GD. I tried the below formula but it doesn't give the correct value, actually it has an error.
=COUNTIF(A:A,VLOOKUP("*Finished Good*",B:GD,2,0))
For VLOOKUP() function, value which you search should be placed at the first column. Then your formula should be like this:
=COUNTIF(D:GD,VLOOKUP("*Finished Good*",A:GD,4,0))
You can try the below formula, if your requirement is to find number of 'NULL' for 'Finished Goods' - I feel this is your requirement.
=SUMPRODUCT((A3:A100="Finished Goods")*COUNTIF(OFFSET($B$3:$GD$100,(ROW(A3:A100)-3),0,1,COLUMNS($B$3:$GC$100)-1),"NULL")*1)
Related
I have an excel sheet that has data in 3 columns. I am trying to write a function that will search each column for a single value. If it finds the value, I want to output the value of the column where the value was found.
I have this formula currently, which does what I want for a single column, but I do not know how to modify it to search additional columns in the same row.
=IF(ISNUMBER(SEARCH("apples",J2)),J2,"")
I tried modifying it to:
=IF(ISNUMBER(SEARCH("apples",I2:J2)),J2,"")
But then I received an excel error saying #SPILL
I want to search columns I2:J2 for the word "apples" and if found, output the value in cell J2
How can I modify my function to do this?
XLOOKUP() may be best fit for you. Try-
=XLOOKUP("Apple",I2:I10,J2:J10,"Not Found",0)
In case of partial match use match_mode parameter 2 for wildcard character match like-
=XLOOKUP("*Apple*",I2:I10,J2:J10,"Not Found",2)
Try this (in rows 1 TO 10 as an example):
=INDEX($J$1:$J$10, MATCH("apples",$I$1:$I$10,0))
I have an Excel spreadsheet with 3 columns. I would like to lookup for a value that can be in the first 2 and then get the corresponding value from the third one.
A B C
Mustang Empty Ford
Camaro Corvette Chevrolet
The VLOOKUP can only search in the first column. What I need is to be able to find a value in column A and B and return the value from C.
=VLOOKUP("Corvette",A1:C2,3,0) returns #N/A (would like to return Chevrolet)
=VLOOKUP("Camaro",A1:C2,3,0) returns Chevrolet
Is it possible?
use AGGREGATE:
=INDEX(C:C,AGGREGATE(15,7,ROW($A$1:$C$2)/($A$1:$C$2=E1),1))
If it is only three columns then this will be quicker:
=INDEX(C:C,IFERROR(IFERROR(MATCH(E1,A:A,0),MATCH(E1,B:B,0)),MATCH(E1,C:C,0)))
But as you can see adding an IFERROR for each column can get out of hand with more columns
Both the above will return the first encountered of the lookup. If the data set is unique, no duplicates in any of the columns the we can use the following.
this uses FILTER which is currently available on Office 365 for Insiders:
=FILTER(C:C,(A:A=E1)+(B:B=E1)+(C:C=E1))
But it does require that the data set be totally filled with unique. If one want to return all that match we can use TEXTJOIN to create a comma separated list:
=TEXTJOIN(",",TRUE,UNIQUE(FILTER(C:C,(A:A=E1)+(B:B=E1)+(C:C=E1))))
You can also try this:
=IFERROR(VLOOKUP(F2,$A$2:$C$3,3,0),VLOOKUP(F2,$B$2:$C$3,2,0))
where F2 is the look up item, and $A$2:$C$3 is the range of your 3 columns.
The logic is to use two VLOOKUP to return the value from the 3rd column if the look up value is in Column A, or return the value from the 2nd column if the look up value is in Column B.
Cheers :)
I like index-match a bit more for this:
=if(Isnumber(match(Thing, FirstColumn,0)),Index(ThirdColumn, Match(Thing, FirstColumn,0)),Index(ThirdColumn,Match(Thing, SecondColumn,0)))
Basically, test for existence in the first column. If its there, keep going, otherwise, use the second column.
I am attempting to Index and Match and find the green value labeled in my table below based on the criteria in the yellow cells. Any idea how to go about this, here is my current formula:
INDEX($A$2:$F$31, MATCH($H$3,$B$2:$B$31,0), MATCH($H$4, $C$2:$C$31,0))
It keeps returning the "Type" and not the "Cats" value I would like to have, 0.1518. Would Vlookup + Match be easier? Any help would be greatly appreciated.
Basically, I am trying to match two row variables (City and Type) with the column variable (cats) to get the value. However, if I use vlookup then maybe I can just say go to the cat column instead of matching it with another cell.
Try this formula:
=INDEX(E2:E31,MATCH(1,INDEX((H3=B2:B31)*(H4=C2:C31),0,1),0))
Based on the non-array version of the formula found here: https://exceljet.net/formula/index-and-match-with-multiple-criteria
I have an Excel file with 2 sheets - one sheet contains my items, prices, codes, etc. and the other sheet is for cross-matching with competitors.
I've included an Excel file and image below.
I want to be able to generate my code automatically when manually entering any of my competitor's codes. I was able to do INDEX/MATCH but I was only able to match with one column (I'm assuming they're all in one sheet to make it easier). Here is my formula:
=INDEX(C:C,MATCH(K2,E:E,0)
So this is looking only in E:E, when I tried to enter a different column such as C:C or D:D it returns an error.
I tried to do the MATCH as C:G but it gave an error right away.
The reason why match gave you error is because it's looking for an array and you put in multiple columns.
There is definitely a more elegant way to do this but this is the first one that I came up with.
=IFERROR(INDEX(B:B,MATCH(K2,C:C,0)),IFERROR(INDEX(B:B,MATCH(K2,D:D,0)),IFERROR(INDEX(B:B,MATCH(K2,E:E,0)),IFERROR(INDEX(B:B,MATCH(K2,F:F,0)),IFERROR(INDEX(B:B,MATCH(K2,G:G,0)),"")))))
Index/Match Combination
Please try this formula:
{=INDEX($B$2:$B$5,MATCH(1,(K2=$C$2:$C$5)+(K2=$D$2:$D$5)+(K2=$E$2:$E$5)+(K2=$F$2:$F$5)+(K2=$G$2:$G$5),0))}
Instruction: Paste the formula {without the curly brackets} to the formula bar and hit CTRL+SHIFT+ENTER while the cell is still active. This will create an array formula. Hence, the curly brackets. Please take note though that manually entering the curly brackets will not work.
Description:
The INDEX function returns a value or the reference to a value from within a table or range.1
The MATCH function searches for a specified item in a range of cells, and then returns the relative position of that item in the range.2
Syntax:
The INDEX function has two forms—Array and Reference form. We're going use the Reference form in this case.
INDEX(reference, row_num, [column_num], [area_num])1
MATCH(lookup_value, lookup_array, [match_type])2
Explanation:
To simplify, we're going to use this form:
INDEX(reference, MATCH(lookup_value, lookup_array, [match_type]))
The INDEX function returns a value from the reference My code column (B1:B5) based on the row_num argument, which serves as an index number to point to the right cell, and we're going to do that by substituting row_num with MATCH function.
MATCH function, on the other hand, returns the relative position of a value in competitorn column that matches the value in individual cells of the competitor code column.
To make it work with multiple lookup range, we're going to create arrays of boolean values (TRUE/FALSE, aka logical values) by comparing values from individual cells in competitor code column with values in individual competitorn columns. Now, we convert these boolean values into numerical values by performing a mathematical operation that does not alter its implied value (i.e. TRUE=1, FALSE=0). We're going to add these values directly to make it simple. The resulting array have four index with two possible values: 1 or 0. Since each item in MATCH's lookup_array is unique, then there can be only one TRUE or 1. The rest are FALSE or 0's. So, with that knowledge, we're going to use it as our lookup_value.
Let's dissect the formula:
=INDEX(B2:B5,MATCH(1,(K2=C2:C5)+(K2=D2:D5)+(K2=E2:E5)+(K2=F2:F5)+(K2=G2:G5),0))
My code 2 = INDEX({"My code 1";"My code 2";"My code 3";"My code 4"},MATCH)
My code 2 = INDEX({"My code 1";"My code 2";"My code 3";"My code 4"},(2))
2 = MATCH(1,(K2=C2:C5)+(K2=D2:D5)+(K2=E2:E5)+(K2=F2:F5)+(K2=G2:G5),0)
2 =MATCH(1,
{FALSE;FALSE;FALSE;FALSE}+
{FALSE;FALSE;FALSE;FALSE}+
{FALSE;FALSE;FALSE;FALSE}+
{FALSE;FALSE;FALSE;FALSE}+
{FALSE;TRUE;FALSE;FALSE},0))
OR
=MATCH(1,
{0;0;0;0}+
{0;0;0;0}+
{0;0;0;0}+
{0;0;0;0}+
{0;1;0;0},0))
=========
{0;1;0;0},0))
2 = MATCH(1,{0;1;0;0},0))
I hope this answer is helpful.
References and links:
INDEX function
MATCH function
Create an array formula
I have a pivot table with format as follows:
I find the highest export quantity in all countries by the formula max(B2:D4) which comes out as 83.
Now I want to find the company name corresponding to this max value i.e. CompanyA in this case.
The actual pivot table has 241 rows and over 40 columns. But the layout is as described.
On Approach would be following formula:
=INDEX($A$1:$A$4,MAX(IF(B2:D4=MAX(B2:D4),ROW(B2:D4)-ROW(A1)+1)))
Entered as a matrix formula with SHift+Ctrl+Enter
This should work for you:
=INDEX(A2:A4,MATCH(MAX(B2:D4),D2:D4,0))
Hope it's what you are looking for!
It would be nice to use a VLOOKUP but this can only find columns to the right of the match, so to go to the left of a match try this solution, which uses the MATCH() and INDEX() functions:
http://www.excel-easy.com/examples/left-lookup.html
Using your example image create 3 new columns (and then if you want combine them all into 1 by aggregating the formulas)
The formula for colum E is just your MAX function
For F it is this: =MATCH(E2,B2:D2,0). The MATCH() function looks for the value contained in cell E2 (which is the max of B2:D2) in the array B2:D2 which is row A of your company values. The trailing ,0 in the function parameters tells the function to look for the first exact match. It thus returns the column where the max value occurred. You can then use the column to look up the names of the companies:
For G it is =INDEX($B$1:$D$1,1,F2)