How to compare only a part of strings in different excel sheets(columns) - excel

How to compare two sheet columns specied below, however only part of string in location(column)in sheet1 will matches only part of string with the Location(column) in sheet2?
1.only 1st two characters of location(column) in sheet1 and 1st two characters of location(column) in sheet2 should match.
2.only any two characters of location(column) in sheet1 and any two characters of location(column) in sheet2 should match. Please help
Location(sheet1) Location(sheet2)
____________________________________________
india- north USxcs
India-west Indiaasd
India- east Indiaavvds
India- south Africassdcasv
US- north Africavasvdsa
us-west UKsacvavsdv
uk- east Indiacascsa
uk- south UScssca
Africa-middle Indiacsasca
Africa-south Africaccc
Africa-east UKcac

For question 1 you can use MID function to extract the first two characters from each cell value and compare them.
For question 2 there is a solution if you can accept a predetermined maximum length of string. It is not a very nice solution! You can use nested if statements, basically 'unrolling the loop'. This example compares cell A1 and B1 for lengths of A1 up to 12 characters:
=IF(IFERROR(FIND(MID(A1,1,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,2,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,3,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,4,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,5,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,6,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,7,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,8,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,9,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,10,2),B1,1),0)>0,TRUE,
IF(IFERROR(FIND(MID(A1,11,2),B1,1),0)>0,TRUE,
FALSE
)
)
)
)
)
)
)
)
)
)
)
Thanks to James Jenkins for this update
It seems older versions of Excel have a limit of 7 nested functions. You can work around this (if you don't mind making your spreadsheet even more ugly) by chaining together formulas in adjacent cells. In fact if you wanted to get really creative you could use the column index to calculate the offsets for the search, something like:
=IF(IFERROR(FIND(MID($A1,(COLUMN(C1) - 3) * 6 + 1, 2), $B1, 1),0)>0,TRUE,
...repeat with +2, +3, +4, +5
if(D2 = FALSE, FALSE, TRUE)
)))))))
Then the column can be copied right if you ever need more string length. Note the innermost 'if' should force a TRUE or FALSE value when the adjacent column is blank.

Related

How do I sum data based on a PART of the headers name?

Say I have columns
/670 - White | /650 - black | /680 - Red | /800 - Whitest
These have data in their rows. Basically, I want to SUM their values together if their headers contain my desired string.
For modularity's sake, I wanted to merely specify to sum /670, /650, and /680 without having to mention the rest of the header text.
So, something like =SUMIF(a1:c1; "/NUM & /NUM & /NUM"; a2:c2)
That doesn't work, and honestly I don't know what i should be looking for.
Additional stuff:
I'm trying to think of the answer myself, is it possible to mention the header text as condition for ifs? Like: if A2="/650 - Black" then proceed to sum the next header. Is this possible?
Possibility it would not involve VBA, a draggable formula would be preferable!
At this point, I may as well request a version which handles the complete header name rather than just a part of it as I believe it to be difficult for formula code alone.
Thanks for having a look!
Let me know if I need to elaborate.
EDIT: In regards to data samples, any positive number will do actually, damn shame stack overflow doesn't support table markdown. Anyway, for example then..:
+-------------+-------------+-------------+-------------+-------------+
| A | B | C | D | E |
+---+-------------+-------------+-------------+-------------+-------------+
| 1 |/650 - Black |/670 - White |/800 - White |/680 - Red |/650 - Black |
+---+-------------+-------------+-------------+-------------+-------------+
| 2 | 250 | 400 | 100 | 300 | 125 |
+---+-------------+-------------+-------------+-------------+-------------+
I should have clarified:
The number range for these headers would go from /100 - /9999 and no more than that.
EDIT:
Progress so far:
https://docs.google.com/spreadsheets/d/1GiJKFcPWzG5bDsNt93eG7WS_M5uuVk9cvkt2VGSbpxY/edit?usp=sharing
Formula:
=SUMPRODUCT((A2:D2*
(MID($A$1:$D$1,2,4)=IF(LEN($H$1)=4,$H$1&"",$H$1&" ")))+(A2:D2*
(MID($A$1:$D$1,2,4)=IF(LEN($I$1)=4,$I$1&"",$I$1&" ")))+(A2:D2*
(MID($A$1:$D$1,2,4)=IF(LEN($J$1)=4,$J$1&"",$J$1&" "))))
Apparently, each MID function is returning false with each F9 calculation.
EDIT EDIT:
Okay! I found my issue, it's the /being read when you ALSO mentioned that it wasn't required. Man, I should stop skimming!
Final Edit:
=SUMPRODUCT((RETURNSUM*
(MID(HEADER,2,4)=IF(LEN(Match5)=4,Match5&"",Match5&" ")))+(RETURNSUM*
(MID(HEADER,2,4)=IF(LEN(Match6)=4,Match6&"",Match6&" ")))+(RETURNSUM*
(MID(HEADER,2,4)=IF(LEN(Match7)=4,Match7&"",Match7&" ")))
The idea is that Header and RETURNSUM will become match criteria like the matches written above, that way it would be easier to punch new criterion into the search table. As of the moment, it doesn't support multiple rows/dragging.
I have knocked up a couple of formulas that will achieve what you are looking for. For ease I have made the search input require the number only as pressing / does not automatically type into the formula bar. I apologise for the length of the answer, I got a little carried away with the explanation.
I have set this up for 3 criteria located in J1, K1 and L1.
Here is the output I achieved:
Formula 1 - SUMPRODUCT():
=SUMPRODUCT((A4:G4*(MID($A$1:$G$1,2,4)=IF(LEN($J$1)=4,$J$1&"",$J$1&" ")))+(A4:G4*(MID($A$1:$G$1,2,4)=IF(LEN($K$1)=4,$K$1&"",$K$1&" ")))+(A4:G4*(MID($A$1:$G$1,2,4)=IF(LEN($L$1)=4,$L$1&"",$L$1&" "))))
Sumproduct(array1,[array2]) behaves as an array formula without needed to be entered as one. Array formulas break down ranges and calculate them cell by cell (in this example we are using single rows so the formula will assess columns seperately).
(A4:G4*(MID($A$1:$G$1,2,4)=IF(LEN($J$1)=4,$J$1&"",$J$1&" ")))
Essentially I have broken the Sumproduct() formula into 3 identical parts - 1 for each search condition. (A4:G4*: Now, as the formula behaves like an array, we will multiply each individual cell by either 1 or 0 and add the results together.
1 is produced when the next part of the formula is true and 0 for when it is false (default numeric values for TRUE/FALSE).
(MID($A$1:$G$1,2,4)=IF(LEN($J$1)=4,$J$1&"",$J$1&" "))
MID(text,start_num,num_chars) is being used here to assess the 4 digits after the "/" and see whether they match with the number in the 3 cells that we are searching from (in this case the first one: J1). Again, as SUMPRODUCT() works very much like an array formula, each cell in the range will be assessed individually.
I have then used the IF(logical_test,[value_if_true],[value_if_false]) to check the length of the number that I am searching. As we are searching for a 4 digit text string, if the number is 4 digits then add nothing ("") to force it to a text string and if it is not (as it will have to be 3 digits) add 1 space to the end (" ") again forcing it to become a text string.
The formula will then perform the calculation like so:
The MID() formula produces the array: {"650 ","670 ","800 ","680 ","977 ","9999","143 "}. This combined with the first search produces {TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE} which when multiplied by A4:G4
(remember 0 for false and 1 for true) produces this array: {250,0,0,0,0,0,0} essentially pulling the desired result ready to be summed together.
Formula 2: =SUM(IF(Array)): [This formula does not work for 3 digit numbers as they will exist within the 4 digit numbers! I have included it for educational purposes only]
=SUM(IF(ISNUMBER(SEARCH($J$1,$A$1:$G$1)),A8:G8),IF(ISNUMBER(SEARCH($K$1,$A$1:$G$1)),A8:G8),IF(ISNUMBER(SEARCH($L$1,$A$1:$G$1)),A8:G8))
The formula will need to be entered as an array (once copy and pasted while still in the formula bar hit CTRL+SHIFT+ENTER)
This formula works in a similar way, SUM() will add together the array values produced where IF(ISNUMBER(SEARCH() columns match the result column.
SEARCH() will return a number when it finds the exact characters in a cell which represents it's position in number of characters. By using ISNUMBER() I am avoiding having to do the whole MID() and IF(LEN()=4,""," ") I used in the previous formula as TRUE/FALSE will be produced when a match is found regardless of it's position or cell formatting.
As previously mentioned, this poses a problem as 999 can be found within 9999 etc.
The resulting array for the first part is: {250,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE} (if you would like to see the array you can highlight that part of the formula and calculate with F9 but be sure to highlight the exact brackets for that part of the formula).
I hope I have explained this well, feel free to ask any questions about stuff that you don't understand. It is good to see people keen to learn and not just fishing for a fast answer. I would be more than happy to help and explain in more depth.
I start this solution with the names in an array, you can read the header names into an array with not too much difficulty.
Sub test()
Dim myArray(1 To 4) As String
myArray(1) = "/670 - White"
myArray(2) = "/650 - black"
myArray(3) = "/680 - Red"
myArray(4) = "/800 - Whitest"
For Each ArrayValue In myArray
'Find position of last character
endposition = InStr(1, ArrayValue, " - ", vbTextCompare)
'Grab the number section from the string, based on starting and ending positions
stringvalue = Mid(ArrayValue, 2, endposition - 2)
'Convert to number
NumberValue = CLng(stringvalue)
'Add to total
Total = Total + NumberValue
Next ArrayValue
'Print total
Debug.Print Total
End Sub
This will print the answer to the debug window.

Excel adding more conditions in a formula

I believed the condtions written will be quite long and i am not really good in writing this long formula
There are 6 columns i've used which is D ,E, M, N, O, P
Sample data:
D3=123456(Changing variable as it can be 12345, 12345A,123456A)
E3=1
M3=31
N3=_
O3=00
P3=0
The formula are design based on this Column D field(the variable changes is in this field) let say
if length of D3 = 6 then (the current formula i've done)
=IF(LEN(D3)=6,CONCATENATE(M3,D3,N3,O3,E3),CONCATENATE(M3,D3,O3,E3))
The outcome for this will be 31123456_001, if let say the D variable is changed to 123456A( the else
in the formula i've shown as no concatenate N3)
then the outcome will be 31123456A001.
I have added in column p, so that i can use it to concatenate to the format that i need.
There are a few more conditions i need to add in,
Which is
1. If the D3= 12345, the format outcome will be 31012345_001 (concatenate M3,P3,D3,N3,O3,E3)
2. If the D= 12345A, the format outcome will be 31012345A001 (concatenate M3,P3,D3,O3,E3)
3. Data for the column D3 field, 12345A, the A alphabet can be in A-Z.
These are the list of all conditions and outcome that i required in a formula.
1. D3 = 123456 then the outcome will be 31123456_001
2. D3 = 123456A then outcome will be 31123456A001
3. D3 = 12345 then outcome will be 31012345_001
4. D3 = 12345A then outcome will be 31012345A001
Additional info:
These are just format as it can be any numbers combinations, the last letter alphabet can be A-Z
D3 = 123456
D3 = 123456A
D3 = 12345
D3 = 12345A
As I couldn't quite catch all the conditions and outcomes, here is an example of how your formula could look:
=IF(LEN(D3)=5,Outcome_1_Concatenation,IF(LEN(D3)=7,Outcome_2_Concatenation,IF(ISNUMBER(VALUE(RIGHT(D3,1))),Outcome_3_Concatenation,Outcome_4_Concatenation)))
Outcome_1_Concatenation => replace with formula when LEN = 5
Outcome_2_Concatenation => replace with formula when LEN = 7
Outcome_3_Concatenation => replace with formula when LEN = 6 and all are numbers
Outcome_4_Concatenation => replace with formula when LEN = 6 and last is character
If you give all examples in a condition => outcome list, I would be glad to help further.
I would look at creating a lookup table range with 3 options for lengths of 5,6,7.
I named my lookup table range "Length".
First setup this lookup table like this:
5 |
=CONCATENATE(M$3,P$3,D$3,IF(ISNUMBER(VALUE(RIGHT(D3,1))),N3,""),O$3,E$3)
6 |
=CONCATENATE(M$3,IF(ISNUMBER(VALUE(RIGHT(D$3,1))),"",P$3),D$3,IF(ISNUMBER(VALUE(RIGHT(D3,1))),N$3,""),O$3,E$3)
7 |
=CONCATENATE(M$3,D$3,IF(ISNUMBER(VALUE(RIGHT(D$3,1))),N$3,""),O$3,E$3)
For any D3 value, it is checking if that last character is a letter, and if not it will insert N3, otherwise it leaves it out.
Also, for any 6 character value, it checks if the last character is a letter, and if so, it will insert P3, otherwise it leaves it out.
Then, your output formula should be:
=VLOOKUP(LEN(D3),Length,2,FALSE)
This makes it clean and simple.
This is your formula plus the added conditions 1 and 2:
=IF(D3=12345,CONCATENATE(M3,P3,D3,N3,O3,E3),IF(D3="12345A",CONCATENATE(M3,P3,D3,O3,E3),IF(LEN(D3)=6,CONCATENATE(M3,D3,N3,O3,E3),CONCATENATE(M3,D3,O3,E3)))
If you want a more generalized version you can check if D3 is a number, the length of it, if D3 ends with a letter, and replace the nested ifs according to your needs
I got my answers, it's
=IF(AND(LEN(D3)>=6,ISNUMBER(RIGHT(D3,1)*1)),M3&D3&N3&O3&E3,IF(AND(LEN(D3)<6,ISNUMBER(RIGHT(D3,1)*1)),M3&P3&D3&N3&O3&E3,IF(AND(LEN(D3)=6,ISTEXT(RIGHT(D3,1))),M3&P3&D3&O3&E3,M3&D3&O3&E3)))

Using tbl.Lookup to match just part of a column value

This question relates to the Schematiq add-in for Microsoft Excel.
Using =tbl.Lookup(table, columnsToSearch, valuesToFind, resultColumn, [defaultValue]) the values in the valuesToFind column have a consistent 3 characters to the left and then varying characters after (e.g. 908-123456 or 908-321654 - i.e. 908 is always consistent)
How can I tell the function to lookup the value based on the first 3 characters only? The expected answer should be the sum of the results of the above, i.e. 500 + 300 = 800
tbl.Lookup() works by looking for an exact match - this helps ensure it's fast but in this case it means you need an extra step to calculate a column of lookup values, something like this:
A2: =tbl.CalculateColumn(A1, "code", "x => LEFT(x, 3)", "startOfCode")
This will give you a new column that you can use for the columnsToSearch argument, however tbl.Lookup() also looks for just one match - it doesn't know how to combine values together if there is more than one matching row in the table, so I think you also need one more step to group your table by the first 3 chars of the code, like this:
A3: =tbl.Group(A2, "startOfCode", "amount")
Because tbl.Group() adds values together by default, this will give you a table with a row for each distinct value of startOfCode and the subtotal of amount for each of those values. Finally, you can do the lookup exactly as you requested, which for your input table will return 800:
A4: =tbl.Lookup(A3, "startOfCode", "908", "amount")

Excel: complicated SUMPRODUCT formula needed

I'm in search of a SUMPRODUCT formula, or a similar sort of formula which does the same thing. It should do the following:
On worksheet A it needs to ignore incorrect zipcodes, meaning
zipcodes which do not consist of 4 numbers and 2 letters need to be
ignored. It also needs to take into account that there sometimes are
superfluous spaces behind the zipcode. And sometimes there is a
space between the numbers and letters, sometimes there isn't. Just
the 4 numbers and 2 letters need to be compared.
The correct zipcodes on worksheet A need to be compared with the
zipcodes on worksheet B. If they match, then all the values behind
the zip code need to be summed up. If there is another record
starting with the same zipcode then these need to be added up as
well.
Neither of the worksheets should need to be changed, since the data is generated frequently. The formula should be able to work on a third, separate worksheet. And it should work in Excel 2003.
EDIT: Added point 3.
I'll add an image to visualize what I mean. Hopefully someone can help me!
With some helper columns, you could use something like this (open in new tab for larger version):
The formulae:
In B2 to remove spaces and hence get a 'clean' ZIP and check the length:
=IF(LEN(SUBSTITUTE(A2," ",""))=6,SUBSTITUTE(A2," ",""),"")
In C2, to get the sum:
=IFERROR(IF(AND(ISNUMBER(LEFT(B2,4)*1),CODE(MID(LOWER(B2),5,1))>=97,CODE(MID(LOWER(B2),5,1))<=122,CODE(RIGHT(LOWER(B2)))>=97,CODE(RIGHT(LOWER(B2)))<=122),SUMPRODUCT($H$2:$K$8*($G$2:$G$8=B2)),""),"")
In G2, I used the same one as in B2:
=IF(LEN(SUBSTITUTE(F2," ",""))=6,SUBSTITUTE(F2," ",""),"")
Without the helper, the formula becomes much longer because of repeating parts:
=IFERROR(IF(AND(LEN(SUBSTITUTE(A2," ",""))=6,ISNUMBER(LEFT(SUBSTITUTE(A2," ",""),4)*1),CODE(MID(LOWER(SUBSTITUTE(A2," ","")),5,1))>=97,CODE(MID(LOWER(SUBSTITUTE(A2," ","")),5,1))<=122,CODE(RIGHT(LOWER(SUBSTITUTE(A2," ",""))))>=97,CODE(RIGHT(LOWER(SUBSTITUTE(A2," ",""))))<=122),SUMPRODUCT($H$2:$K$8*(SUBSTITUTE($F$2:$F$8," ","")=SUBSTITUTE(A2," ",""))),""),"")
Or
=IFERROR(
IF(
AND(
LEN(SUBSTITUTE(A2," ",""))=6, ' Check length
ISNUMBER(LEFT(SUBSTITUTE(A2," ",""),4)*1), ' Check numbers
CODE(MID(LOWER(SUBSTITUTE(A2," ","")),5,1))>=97, ' Check if letter
CODE(MID(LOWER(SUBSTITUTE(A2," ","")),5,1))<=122, ' Check if letter
CODE(RIGHT(LOWER(SUBSTITUTE(A2," ",""))))>=97, ' Check if letter
CODE(RIGHT(LOWER(SUBSTITUTE(A2," ",""))))<=122 ' Check if letter
),
SUMPRODUCT(
$H$2:$K$8*
(SUBSTITUTE($F$2:$F$8," ","")=SUBSTITUTE(A2," ",""))),
""
),
""
)
Oops, forgot that IFERROR was not in 2003. The only reason why I used it was that MID would return an empty string and CODE would subsequently give an error. You can use the below instead which makes sure the string is 6 chars first:
=IF(LEN(SUBSTITUTE(A2," ",""))=6,IF(AND(ISNUMBER(LEFT(SUBSTITUTE(A2," ",""),4)*1),CODE(MID(LOWER(SUBSTITUTE(A2," ","")),5,1))>=97,CODE(MID(LOWER(SUBSTITUTE(A2," ","")),5,1))<=122,CODE(RIGHT(LOWER(SUBSTITUTE(A2," ",""))))>=97,CODE(RIGHT(LOWER(SUBSTITUTE(A2," ",""))))<=122),SUMPRODUCT($H$2:$K$8*(SUBSTITUTE($F$2:$F$8," ","")=SUBSTITUTE(A2," ",""))),""),"")
Here you have a formula to validate Dutch postal codes
=AND(LEN(A2)=6; ISNUMBER(VALUE(LEFT(A2;4))); CODE(MID(LOWER(A2);5;1)) >= 97; CODE(MID(LOWER(A2);5;1)) <= 122; CODE(MID(LOWER(A2);6;1)) >= 97; CODE(MID(LOWER(A2);6;1)) <= 122)
0-9 = ASCII code 48 to 57
a-z = ASCII code 97 to 122 (lowercase)
In case you have a Dutch version of Excel, the formula would be:
=EN(LENGTE(A2)=6; ISGETAL(WAARDE(LINKS(A2;4))); CODE(DEEL(KLEINE.LETTERS(A2);5;1)) >= 97; CODE(DEEL(KLEINE.LETTERS(A2);5;1)) <= 122; CODE(DEEL(KLEINE.LETTERS(A2);6;1)) >= 97; CODE(DEEL(KLEINE.LETTERS(A2);6;1)) <= 122)

Return a row number that matches multiple criteria in vbs excel

I need to be able to search my whole table for a row that matches multiple criteria. We use a program that outputs data in the form of a .csv file. It has rows that separate sets of data, each of these headers don't have any columns that are unique in of them self but if i searched the table for multiple values i should be able to pinpoint each header row. I know i can use Application.WorksheetFunction.Match to return a row on a single criteria but i need to search on two three or four criteria.
In pseudo-code it would be something like this:
Return row number were column A = bill & column B = Woods & column C = some other data
We need to work with arrays:
There are 2 kinds of arrays:
numeric {1,0,1,1,1,0,0,1}
boolean {TRUE,FALSE,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE}
to convert between them we can use:
MATCH function
MATCH(1,{1,0,1,1,1,0,0,1},0) -> will result {TRUE,FALSE,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE}
simple multiplication
{TRUE,FALSE,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE}*{TRUE,FALSE,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE} -> will result {1,0,1,1,1,0,0,1}
you can can check an array in the match function, entering it like in the picture below, be warned that MATCH function WILL TREAT AN ARRAY AS AN "OR" FUNCTION (one match will result in true
ie:
MATCH(1,{1,0,1,1,1,0,0,1},0)=TRUE
, YOU MUST CTR+SHIFT+ENTER !!! FOR IT TO GIVE AN ARRAY BACK!!!
in the example below i show that i want to sum the hours of all the employees except the admin per case
we have 2 options, the long simple way, the complicated fast way:
long simple way
D2=SUMPRODUCT(C2:C9,(A2=A2:A9)*("admin"<>B2:B9)) <<- SUMPRODUCT makes a multiplication
basically A1={2,3,11,3,2,4,5,6}*{0,1,1,0,0,0,0,0} (IT MUST BE A NUMERIC ARRAY TO THE RIGHT IN SUMPRODUCT!!!)
ie: A1=2*0+3*1+11*1+3*0+2*0+4*0+5*0+6*0
this causes a problem because if you drag the cell to autocomplete the rest of the cells, it will edit the lower and higher values of
ie: D9=SUMPRODUCT(C9:C16,(A9=A9:A16)*("admin"<>B9:B16)), which is out of bounds
same as the above if you have a table and want to view the results in a diferent order
the fast complicated way
D3=SUMPRODUCT(INDIRECT("c2:c9"),(A3=INDIRECT("a2:a9"))*("admin"<>INDIRECT("b2:b9")))
it's the same, except that INDIRECT was used on the cells that we want not be modified when autocompleting or table reorderings
be warned that INDIRECT sometimes give VOLATILE ERROR,i recommend not using it on a single cell or using it only once in an array
f* c* i cant post pictures :(
table is:
case emplyee hours totalHoursPerCaseWithoutAdmin
1 admin 2 14
1 him 3 14
1 her 11 14
2 him 3 5
2 her 2 5
3 you 4 10
3 admin 5 10
3 her 6 10
and for the functions to check the arrays, open the insert function button (it looks like and fx) then doubleclick MATCH and then if you enter inside the Lookup_array a value like
A2=A2:A9 for our example it will give {TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE} that is because only the first 3 lines are from case=1
Something like this?
Assuming that you data in in A1:C20
I am looking for "Bill" in A, "Woods" in B and "some other data" in C
Change as applicable
=IF(INDEX(A1:A20,MATCH("Bill",A1:A20,0),1)="Bill",IF(INDEX(B1:B20,MATCH("Woods",B1:B20,0),1)="Woods",IF(INDEX(C1:C20,MATCH("some other data",C1:C20,0),1)="some other data",MATCH("Bill",A1:A20,0),"Not Found")))
SNAPSHOT
I would use this array* formula (for three criteria):
=MATCH(1,((Range1=Criterion1)*(Range2=Criterion2)*(Range3=Criterion3)),0)
*commit with Ctrl+Shift+Enter

Resources