Let's say I have the folowing values setup in excel:
1 | 2 | 3 |
a | b | c |
Above thess values I have a INDEX MATCH formula that looks up a translation of the numbers 1-3:
=INDEX(PartnersProjects[Name];MATCH(K1;PartnersProjects[ID];0))
K1` is the reference to value "1" and picks up "Test1" with current output:
Test1 | Test2 | Test3 |
1 | 2 | 3 |
a | b | c |
But when I convert the 2 rows with according 3 colums (1-3 and a-c) to a table, the formula in the row above stops working some how. How to solve this?
When you make the row 1, 2, 3 as the header row of a table, this forces Excel to evaluate it as a string because these becomes the names of the columns.
You have two solutions:
1- Convert the searched value (K1) to numeric before matching:
=INDEX(PartnersProjects[Name],MATCH(VALUE(K1),PartnersProjects[ID],0))
' ^^^^^^^^^
2- Convert the search range to text, but then you will need an ^array (CSE) formula:
=INDEX(PartnersProjects[Name],MATCH(K1,TEXT(PartnersProjects[ID], "0"),0))
' Ctrl+Shift+Enter ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Related
There are 4 columns. 1st column has the result, 2nd column has a backup result if the 1st column is empty, the 3rd column has the low/floor value of range, and the 4th column has the high/ceiling value of range.
The Excel formula should check and see what row the search value sits in between columns 3 and 4, and then pulls column 1 if a value is found, or pulls column 2.
| 1st Column | 2nd Column|3rd Column ||3rd Column |
|------------|------------|-----------|------------|
| a |az1 | 1 | 5 |
| b |az2 | 6 | 10 |
| c |az3 | 11 | 15 |
| - |az4 | 16 | 20 |
Search Value 1: 13
Result: c
Search Value 2: 6
Result: b
Search Value 3: 19
Result: az4
Thank you in Advance for help and guidance!!
Try this formula for the all Excel versions.
In G2, enter formula :
=LOOKUP(F2,C2:C5,IF({0;0;0;1},B2:B5,A2:A5))
One way with Office 365 is:
=LET( x, G2,
low, $A$1:$B$4,
high, $C$1:$C$4,
t, INDEX(low, MATCH(x,high,1),),
INDEX( t, 1, IF(ISBLANK(INDEX(t,1,1)),2,1) ) )
You can put an IFERROR in it if you want it to give the "No Scores" result.
If you can help me I love you.
Let's say I have a bunch of URLs:
| Range 1 |
|------------------------|
| www.orange.com |
| www.orange.example.com |
| www.example.red.com |
| www.example.com/blue |
And I also have a table like this:
| Range 2 | Range 3 |
|---------|---------|
| orange | 1 |
| red | 2 |
| blue | 3 |
| green | 4 |
| pink | 5 |
How could I write a formula to pull down alongside the URL list so that it looks like:
| Range 1 | Results |
|------------------------|---------|
| www.orange.com | 1 |
| www.orange.example.com | 1 |
| www.example.red.com | 2 |
| www.example.com/blue | 3 |
Essentially doing partial matches every time and then returning a result to the right.
Driving me nuts, you're my only hope!
Google Sheets.
=ArrayFormula(LOOKUP(1,0/COUNTIF(A1,"*"&C$1:C$5&"*"),D$1:D$5))
MSOFFICE
=LOOKUP(1,0/FIND(C$1:C$5,A1),D$1:D$5)
This will only work if the string does not contain multiple partial strings in your list, but you can just INDEX the lookup array using the row number of a partial match.
For example:
=IFERROR(
INDEX($B$1:$B$5, CONCAT(IFERROR(
FIND($A$1:$A$5,D5)+ROW($A$1:$A$5)-FIND($A$1:$A$5,D5),
""))),"")
Here we first generate a vector testing the location of all values in the lookup array against the string using FIND. All but one element in this vector are #VALUE!. The remaining element is the location of the first character in the string being tested that is the same as the value in the lookup array.
Next we convert this value to the row number in the lookup array by adding another equal sized vector of sequential row numbers, and then subtracting the original quantity. Note that arithmetic on a #VALUE! return will still yield #VALUE!. Also note that the vector of row numbers as generated in the answer above (the ...ROW($A$1:$A$5)) must begin in the first row; if your lookup array starts in row 3 for example, you would need to do something like ...ROW($A$3:$A$7)-2 to get the result you desire.
Finally, we replace any #VALUE! return with an empty string and concatenate the entire vector. The result is the row number of the lookup array which contains a partial string in the full string. This row number is used in an INDEX to achieve the desired results.
I have a sheet where I am recording what I eat:
Another where I keep an index of values to lookup
I tried
=SUM(VLOOKUP('Sheet1'!A2:A11,'Sheet2'!A2:E11,2,FALSE))
but that only returned the first match, so then I tried
=SUMPRODUCT(SUMIF('Sheet1'!A2:A11,'Sheet2'!A2:A11,'Sheet2'!B2:B11))
but that isn't working either.
does anyone have a solution, where I can also multiply the value of the return match by the # of servings in the first sheet?
Thanks!
If you want a single output of calories through SUMPRODUCT then you can use
=SUMPRODUCT(B2:B11*IFERROR(VLOOKUP(A2:A11,Sheet2!A2:B11,2,0),0))
If you are sure that all entries on Sheet 1 can be located on Sheet 2 then you can drop IFERROR portion like
=SUMPRODUCT(B2:B11*VLOOKUP(A2:A11,Sheet2!A2:B11,2,0)).
Beware that if a value is not found in Sheet 2 then formula will produce wrong result as IFERROR will multiply the serving quantity with 0.
I combine 2 tables into one sheet, Table 1 housed in Column A & B and Table 2 housed in Column D & E
In G2, "Total Serving Colories" enter formula :
=SUMPRODUCT(VLOOKUP(T(IF({1},A2:A12)),D2:E12,2,FALSE)*B2:B12)
It's not super-clear what you're trying to get at. But defining the "Calories Per Serving" in a range called "cals",
+---+---------+-----+--------------------------------+
| | A | B | C |
+---+---------+-----+--------------------------------+
| 1 | egg | 3 | =(VLOOKUP(A2,cals,2,FALSE))*B2 |
| 2 | oatmeal | 1.5 | =(VLOOKUP(A3,cals,2,FALSE))*B3 |
| 3 | shrimp | 2 | =(VLOOKUP(A4,cals,2,FALSE))*B4 |
+---+---------+-----+--------------------------------+
Results in:
In Excel 365 I'm using an "IFS" statement to scan through a number of columns to find out if a cell's value is in any of the columns. I believe "IFS" will process all your conditions until it reaches the first one that is "TRUE" then output. However, I'd like to be able to find ALL instances where my condition is true and output or evaluate them all somehow. Is there a way to do this with IFS (or some other method)? I think I'd like to output the matching value for each true condition in a separate row, but anything that could help me see how many matched and/or which column each match is in would be helpful.
The code I have is a bit much to share as my columns are in other workbooks, so I'll just share a close example. This formula would be in a cell that outputs the match, column D below.
A | B | C | D | E
------------------------------------
ColA | Col1 | Col2 | Formula | Notes
------------------------------------
1 | 1 | 2 | 1 | Two matches in same column (Col1)
2 | 1 | 2 | 2 | Two matches in same column (Col2)
3 | 3 | 3 | 3 | Two matches in diff column (Col1 & Col2)
=IFS(
NOT(ISERROR(MATCH(INDIRECT("A"&(ROW())),INDIRECT("B:B"),0))),
INDEX(INDIRECT("B:B"),MATCH(INDIRECT("A"&(ROW())),INDIRECT("B:B"),0)),
NOT(ISERROR(MATCH(INDIRECT("A"&(ROW())),INDIRECT("C:C"),0))),
INDEX(INDIRECT("C:C"),MATCH(INDIRECT("A"&(ROW())),INDIRECT("C:C"),0))
)
Of course the expected output is to dump the matching value of the first condition that's true, but I'd like to output all instances the condition is true in separate rows if possible. Maybe something like this...
A | B | C | D | E
------------------------------------
ColA | Col1 | Col2 | Formula | Notes
------------------------------------
1 | 1 | 2 | 1 | Two matches in same column (Col1)
... | ... | ... | 1 | Two matches in same column (Col1)
2 | 1 | 2 | 2 | Two matches in same column (Col2)
... | ... | ... | 2 | Two matches in same column (Col2)
3 | 3 | 3 | 3 | Two matches in diff column (Col1 & Col2)
... | ... | ... | 3 | Two matches in diff column (Col1 & Col2)
In the above and in my actual case the '...' would display what's in the column of that particular row match, which may vary from one row to another row throughout the worksheets. Basically, column D in the example would be on a separate 'results' sheet with the same amount of columns and column value types as all the 'data' sheets being searched. Furthermore, each column of the 'results' sheet would be a formula scanning that one specific column in all sheets, but only outputting the given column value of the matched row. Something like below...
DATA SHEET
A | B | C
----------------------
FName | LName | Amount
----------------------
John | Doe | 10
Jane | Doe | 4
Jack | Black | 10
RESULTS SHEET
(all cells are formulas)
A | B | C
----------------------
FName | LName | Amount
----------------------
John | Doe | 10 < matching value in C
Jack | Black | 10 < but different A & C
I hope that last part answered any "why" questions. ;)
ADDITION (7/25/19):
Below is the complete formula I'm using on sheets like above, but with more columns. It works well with the exception of my requirement to know where ALL matches occur and not just the first match on the IFS statement. Column "F" is the column I'm matching to output the corresponding value from the column cell on the match's row as found on the data sheets (5 sheets) to the formulated 'results' sheet, as displayed above. The only thing that changes in the formula between cells is the "A:A" to "B:B" etc., including "F:F" (the column with the value to be "MATCHED" from "SOURCES!$B$2"), which I made the last condition in the formula case nothing is found in the other data sheets, pasting its own data in lieu of something like 0, N/A, or FALSE.
=IFS(
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$3)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$3)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$3)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$4)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$4)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$4)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$12)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$12)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$12)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$13)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$13)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$13)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$14)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$14)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$14)&"F:F"),0)),
NOT(ISERROR(MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$2)&"F:F"),0))),
INDEX(INDIRECT((SOURCES!$B$2)&"A:A"),MATCH(INDIRECT((SOURCES!$B$2)&"F"&(ROW())),INDIRECT((SOURCES!$B$2)&"F:F"),0))
)
My formulated "results" workbook also has a worksheet named "SOURCES" that I use to paste file names to connect all the data sheets corresponding columns.
Btw, I'm using this as a tool to 'un-merge' customer data between profiles in our LIVE site/database after obtaining all the tables and columns the customer key has been found (using SQL) to then compare it (using Excel) to our TEST site so I can pull apart the data that doesn't belong on the 'kept' record from the LIVE merge. In this case there were 3 records merged. Two records have a profile in the TEST site, while the kept record from the LIVE site actually does not have a TEST record, giving me 5 sheets of data to examine.
Suppose your data starting from the range A2:C2
I thing this formula can help you,
Array Formula (Use Ctrl+Shift+Enter)
=INDEX($A2:$C2,MATCH("OK",IF(ISNUMBER($A2:$C2),"OK",""),0))
Say I have a table like this (the letters at the top and numbers down the side represent row/columns):
| A | B | C | D
------+----+----+----
1 | 1 | 2 | 3 | 4
2 | 5 | 6 | 7 | 8
and I want to find the cell name using the cell contents, so if the input into my function was 5, the function would return A2, as that is the position at which 5 is located.
If your data is within columns A to Z and there is only one occurrence of the particular value you are looking for, you can use the following formula:
=CHAR(SUMPRODUCT((A1:D2=5)*COLUMN(A1:D2))+64)&SUMPRODUCT((A1:D2=5)*ROW(A1:D2))
SUMPRODUCT((A1:D2=5)*COLUMN(A1:D2)) returns the column number where 5 is located.
SUMPRODUCT((A1:D2=5)*ROW(A1:D2)) returns the row number where 5 is located.
CHAR(65) gives A, so you add the column number to 64 to get the column letter.
E.g. if it is the first column, you get CHAR(1+64) which is CHAR(65) which is A.