I have two sheets sheet1 and sheet2.There is a text in sheet1 'customer'.I want to find the column name like A from sheet2 if text 'customer' found in a cell of row 1 of sheet2.I am using Match function but it is returning only the index.Is there a way to find the column name like A?
Took me a while of playing around but this will work for EXACT matches.
As the example data states Client and not Clients it returns an error and therefore is forced to state "Not Found". In cell B2 of sheet 1, copied down is the formula:
=IFERROR(SUBSTITUTE(ADDRESS(1,MATCH(A2,Sheet2!$A$1:$D$1,0),4),"1",""),"Not Found")
Related
I have an Excel workbook with 2 sheets.
I want to use Sheet 1 as the source to populate a column in Sheet 2.
Sheet 2, Column B has a list of resource names
Sheet 1, contains many of the same names in Column A, and a list of managers in Column F
I want to populate a separate column in Sheet 2 with the managers name from Sheet 1 based on matching the resource names.
I want to get a result of NOT FOUND if names don't match
I've tried
IFERROR(VLOOKUP(B8,'SHEET 1',!$A$3:$AR:100,6,FALSE),"NOT FOUND"), but this formula always returns "NOT FOUND" even though there are matches in Sheet 1
Looks like the ranges in your vlookup are a little wonky, e.g., 'SHEET 1',!$A$3:$AR:100
To be a little more straighforward, let's give you an index/match formula, so you can more easily specify the search array from the output array:
=IfError(Index(Sheets1!$B:$B,Match(Sheets2!B8,Sheets1!$A:$A,0)),"Not Found")
How this works is you Match() the cell on Sheets2! (B8 from your example formula) within the search array, Sheets1!$A:$A (yes, you can use a whole column which makes things a little easier). If nothing is matched, it throws an error (so if-error handles that); if it is found, then it will output (index) based on the output array, Sheets1!$B:$B.
You will want to fix the search array column and output array column to fit your scenario.
I have a if formula with a number of criterias it has to match.
When I have shortened the formula down it works from beyond - IF(LEFT(A6,1)="2"
but there are no reasons it should error at this point? Any help?
=IF(LEFT(A6,2)="10","Area 1",IF(LEFT(A6,2)="12","Area 2",IF(LEFT(A6,2)="13","Area 3",IF(LEFT(A6,2)="14","Area 4",IF(LEFT(A6,2)="15","Area 5",IF(LEFT(A6,2)="16","Area 6",IF(LEFT(A6,2)="17","Area 7",IF(LEFT(A6,1)="2","Bulk",IF(LEFT(A6,1)="4","Intl",IF(LEFT(A6,2)="7","CGCC","Ad-Hoc"))))))))))
You can try combining IF and VLOOKUP.
=IF(LEFT(A6,1)="4","Intl",IF(ISNA(VLOOKUP(LEFT(A6,2),{"7","CGCC";"10","Area 1";"12","Area 2";"13","Area 3";"14","Area 4";"15","Area 5";"16","Area 6";"17","Area 7"},2,FALSE)),"Ad-Hoc",VLOOKUP(LEFT(A6,2),{"7","CGCC";"10","Area 1";"12","Area 2";"13","Area 3";"14","Area 4";"15","Area 5";"16","Area 6";"17","Area 7"},2,FALSE)))
I embedded the array in the formula but you can prepare a table (assume G1:H7) like this:
and then use the VLOOKUP with the reference:
=IF(LEFT(A6,1)="4","Intl",IF(ISNA(VLOOKUP(LEFT(A6,2),G1:H7,2,FALSE)),"Ad-Hoc",VLOOKUP(LEFT(A6,2),G1:H7,2,FALSE)))
IFNA or IFERROR could also be used but they are not available in Excel 2003.
Your entire formula could be shortened to 2 VLOOKUP functions, by putting your data into a table, with your ID column on, say, column A of sheet2, and your results column on column B of sheet2. This would look as follows:
=IFERROR(VLOOKUP(LEFT(A6,2),'Sheet2'!A:B,2,0),IFERROR(VLOOKUP(LEFT(A6),'Sheet2'!A:B,2,0),"Ad Hoc"))
What this does is: first try to match the left 2 characters in A6 to one of your ID's in column A in sheet2. If that creates an error, it tries to match the left 1 character in A6 to one of your ID's in column A of sheet2. Either way, it returns the matching value in column B of sheet2. If no match is found, it returns "Ad Hoc".
I have two excel sheets that I am working with. Sheet 1 has a 'last name' column D and sheet 2 has a 'name' column A. the 'name' column contains last,first name so I need a partial match option to find the customers last name in each sheet and create a new list using the information found in the 'name' column A from sheet 2 in another sheet. This may be simple but for someone who lacks in excel I would appreciate the help.
You could perform an INDEX MATCH function with wildcard search.
=INDEX(B:B,
MATCH("*"&D2&"*",Sheet2!A:A,0),1)
The match function will search for the partial string in cell D2. (Which would be a last name assuming D1 is the title of the column) - The "*"& part on either side of D2 searches for the partial string. If the column only contained last names, it would just be
=INDEX(B:B,
MATCH(D2,Sheet2!A:A,0),1)
After it searches for the partial string, it will search through column A in Sheet2 and find the name which matches (Lets hope you do not have duplicate names).
Once you have matched two names, in comes the INDEX function. This will obtain the corresponding value from any column you want but only in the same row as that last name.
If you want it all in another sheet, you could do.
=INDEX(Sheet1!B:B,
MATCH(Sheet1!"*"&D2&"*",Sheet2!A:A,0),1)
Maybe chuck in some error handling as well.
=IFNA(INDEX(Sheet1!B:B,
MATCH(Sheet1!"*"&D2&"*",Sheet2!A:A,0),1), "No Match or No Data")
What I want to do is to say if the contents of cell D3 (on current worksheet) exist in column A in the first worksheet (in my case entitled list). (and they always do exist somewhere). Return the contents of the corresponding row in Column C.
In other words if the matching cell is found in Row 12 - return data from C12.
I've used the following syntax but I can't seem to get the last part to work correctly.
=IF(ISERROR(MATCH(D3,List!A:A, 0)), "No Match", VLOOKUP(D3,List!A:A,1,TRUE))
How to fix the formula?
You can use following formulas.
For Excel 2007 or later:
=IFERROR(VLOOKUP(D3,List!A:C,3,FALSE),"No Match")
For Excel 2003:
=IF(ISERROR(MATCH(D3,List!A:A, 0)), "No Match", VLOOKUP(D3,List!A:C,3,FALSE))
Note, that
I'm using List!A:C in VLOOKUP and returns value from column № 3
I'm using 4th argument for VLOOKUP equals to FALSE, in that case VLOOKUP will only find an exact match, and the values in the first column of List!A:C do not need to be sorted (opposite to case when you're using TRUE).
Basically my problem is that I have a string in one cell in excel, I then need to see if that string exists in another row (not one cell but the whole row) and if so then print the contents of another cell in the same row but in another column.
I will give a basic example:
Title Answer
Police 15
Ambulance 20
Fire 89
Now I need to scan the title column for, say, "Police" and then populate the cell with the value under Answer (in this case 15).
I cant just say IF(A2="Police";B2;"" as I need the scan the whole of the Title column.
I have tried using IF(COUNTIF(A$2:A$100;"Police"); which scans the contents of A2 to A100 for the string Police, and know how to make it print a constant (just put something after the ;) but cant work out how to make that "constant" a variable that changes depending on the found row. So if the COUNTIF found Police in cell A44 then the answer to my formula would be B44, the same as if it found Police in A62 then my formula should show B62
I hope this makes sense and that someone can help me :)
Note that I am using excel 2010 and need a normal formula as I can not use scripting for this document.
EDIT:
Here is what I have so far, note that the spreadsheet I am using is far more complex than the "simple" example I have in the question...
=IF(ISNUMBER(FIND("RuhrP";F9));LOOKUP(A9;Ruhrpumpen!A$5:A$100;Ruhrpumpen!I$5:I$100);"")
This is showing "RuhrP" in every answer where "RuhrP" is found in F9 and not the answer I want which should be that found in RuhrPumpen!I$5:I$100 where the cell index is the same as that for the A coloum where A9 was found. Again, sorry for the complexity I cant think of any better way to word it.
I note you suggested this formula
=IF(ISNUMBER(FIND("RuhrP";F9));LOOKUP(A9;Ruhrpumpen!A$5:A$100;Ruhrpumpen!I$5:I$100);"")
.....but LOOKUP isn't appropriate here because I assume you want an exact match (LOOKUP won't guarantee that and also data in lookup range has to be sorted), so VLOOKUP or INDEX/MATCH would be better....and you can also use IFERROR to avoid the IF function, i.e
=IFERROR(VLOOKUP(A9;Ruhrpumpen!A$5:Z$100;9;0);"")
Note: VLOOKUP always looks up the lookup value (A9) in the first column of the "table array" and returns a value from the nth column of the "table array" where n is defined by col_index_num, in this case 9
INDEX/MATCH is sometimes more flexible because you can explicitly define the lookup column and the return column (and return column can be to the left of the lookup column which can't be the case in VLOOKUP), so that would look like this:
=IFERROR(INDEX(Ruhrpumpen!I$5:I$100;MATCH(A9;Ruhrpumpen!A$5:A$100;0));"")
INDEX/MATCH also allows you to more easily return multiple values from different columns, e.g. by using $ signs in front of A9 and the lookup range Ruhrpumpen!A$5:A$100, i.e.
=IFERROR(INDEX(Ruhrpumpen!I$5:I$100;MATCH($A9;Ruhrpumpen!$A$5:$A$100;0));"")
this version can be dragged across to get successive values from column I, column J, column K etc.....
Assuming
source data range is A1:B100.
query cell is D1 (here you will input Police or Fire).
result cell is E1
Formula in E1 = VLOOKUP(D1, A1:B100, 2, FALSE)
I figured out such data design:
Main sheet:
Column A: Pump codes (numbers)
Column B: formula showing a corresponding row in sheet 'Ruhrpumpen'
=ROW(Pump_codes)+MATCH(A2;Ruhrpumpen!$I$5:$I$100;0)
Formulae have ";" instead of ",", it should be also German notation. If not, pleace replace.
Column C: formula showing data in 'Ruhrpumpen' column A from a row found by formula in col B
=INDIRECT("Ruhrpumpen!A"&$B2)
Column D: formula showing data in 'Ruhrpumpen' column B from a row found by formula in col B:
=INDIRECT("Ruhrpumpen!B"&$B2)
Sheet 'Ruhrpumpen':
Column A: some data about a certain pump
Column B: some more data
Column I: pump codes. Beginning of the list includes defined name 'Pump_codes' used by the formula in column B of the main sheet.
Spreadsheet example: http://www.bumpclub.ee/~jyri_r/Excel/Data_from_other_sheet_by_code_row.xls
Guys Its very interesting to know that many of us face the problem of replication of lookup value while using the Vlookup/Index with Match or Hlookup.... If we have duplicate value in a cell we all know, Vlookup will pick up against the first item would be matching in loopkup array....So here is solution for you all...
e.g.
in Column A we have field called company....
Column A Column B Column C
Company_Name Value
Monster 25000
Naukri 30000
WNS 80000
American Express 40000
Bank of America 50000
Alcatel Lucent 35000
Google 75000
Microsoft 60000
Monster 35000
Bank of America 15000
Now if you lookup the above dataset, you would see the duplicity is in Company Name at Row No# 10 & 11. So if you put the vlookup, the data will be picking up which comes first..But if you use the below formula, you can make your lookup value Unique and can pick any data easily without having any dispute or facing any problem
Put the formula in C2.........A2&"_"&COUNTIF(A2:$A$2,A2)..........Result will be Monster_1 for first line item and for row no 10 & 11.....Monster_2, Bank of America_2 respectively....Here you go now you have the unique value so now you can pick any data easily now..
Cheers!!!
Anil Dhawan