Excel tips


Published on

Excel tips

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Excel tips

  1. 1. Samples:=IF(ISNA(VLOOKUP(A3,PostCodeFull!$A$3:$G$25000,7,FALSE)),0,VLOOKUP(A3,PostCodeFull!$A$3:$G$25000,7,FALSE))=IF(ISNA(VLOOKUP(P3,Addressbook!$A$3:$G$25000,7,FALSE)),0,VLOOKUP(P3,Addressbook !$A$3:$G$25000,7,FALSE))=IF(ISNA(VLOOKUP($B3,CostAve02!$A$3:$I$65000,9,FALSE)),"NoCost",VLOOKUP($B3, CostAve02!$A$3:$I$65000,9,FALSE))=IF(ISNA(VLOOKUP(P3,Addressbook!(A3:E2000,3,FALSE)),"Missing",A3,VLOOKUP(Addressbook!(P3,A3:E20000,3,FALSE)))Check data type, numeric to numeric column or text to text type data1Problem:Column B contains values to look up in List1 (Column A).How could we alter the results returned by the VLOOKUP function so that they willinclude the original value looked up and a ""Found""/""Not Found"" indication?1.Solution:Use the ISNA and VLOOKUP functions in an IF statement, as follows:=IF(ISNA(VLOOKUP(B2,$A$2:$A$7,1,FALSE)),B2&"" NotFound"",VLOOKUP(B2,$A$2:$A$7,1,FALSE)&"" Found"")List1_____Values to look______ResultBlue______Pink________________Pink Not FoundRed_______Blue________________Blue FoundGreen_____White_______________White Not FoundBlack_____Purple______________Purple Not FoundYellow____Red_________________Red FoundOrangeProblem:Columns A & B contain two lists of values.We want to create a formula that will check whether there is any duplication ofEXCELTips2.doc 18-04-2012 1
  2. 2. values within either list (blank cells are to be ignored).Solution:Use the COUNTA, SUMPRODUCT, and COUNTIF functions as shown in the followingformula:=IF(COUNTA(A2:A7)=SUMPRODUCT((A2:A7<>"")/COUNTIF(A2:A7,A2:A7&"")),"NoDuplicates","Duplicates")The formula will return "Duplicates" if the list contains duplicate values, otherwise it willreturn "No Duplicates".List1____List21________123________BA________2________31________4Problem:Column B in sheet1 contains numbers. Columns B:C in sheet2 contain numbersand their matching text.How could we find the text in sheet2 matching each number in sheet1?Solution:The following formula will find the text in sheet2 matching to the number in cell B13 insheet1:=IF(ISNA(VLOOKUP(B13,$B$20:$B$24,1,FALSE)),"NotFound",VLOOKUP(B13,$B$20:$C$24,2,FALSE))In case the number is not found in sheet2, using ISNA function, the formula will returnNot Found.Example:Sheet1Number__Result_______Formula1_______One__________=IF(ISNA(VLOOKUP(B13,$B$20:$B$24,1,FALSE)),"NotFound",VLOOKUP(B13,$B$20:$C$24,2,FALSE((EXCELTips2.doc 18-04-2012 2
  3. 3. 9_______Not Found____=IF(ISNA(VLOOKUP(B14,$B$20:$B$24,1,FALSE)),"NotFound",VLOOKUP(B14,$B$20:$C$24,2,FALSE((3_______Three________=IF(ISNA(VLOOKUP(B15,$B$20:$B$24,1,FALSE)),"NotFound",VLOOKUP(B15,$B$20:$C$24,2,FALSE))Sheet2Number__Text4_______Four5_______Five3_______Three6_______Six1_______OneTo eliminate errors that occur when using the Vlookup Formula:In the screenshot below are four Vlookup Formulas. In this example, we asume that theindex number 1346 is not included in the index list in the leftmost column of the datatable, the index number 1353 is included and the defined Name for the data table is Data:Cell C2: The fourth argument of the Vlookup Formula is empty, therefore, the formulareturns a result according to a number equal to or less than the lookup number from theindex list.Cell C4: In the fourth argument of the Vlookup Formula = FALSE, therefore, the formulareturns errors when the lookup value is not included in the index list, which is the leftmostcolumn of the data table.Cell C6: The ISERROR formula, nested in the IF formula, returns TRUE when VlookupFormula returns an error, and therefore, the final result is 0.Cell C8: The ISERROR formula nested in the IF formula returns FALSE and the Vlookupformula returns the appropriate result number.Problem:Columns C & D contain pairs of row and column numbers representing some ofthe cells in Data Range (A2:B5).We want to create a cell reference from each pair of numbers in columns C & D andthen retrieve the value stored in that cell.Solution:EXCELTips2.doc 18-04-2012 3
  4. 4. "Use the INDIRECT and ADDRESS functions as shown in the following formula:=INDIRECT(ADDRESS(C2,D2))Problem:Range1 (A3:C7) contains file names with their matching types and sizes.Range2 (A12:B16) contains a similar list of file names but with matching types only.We want to find the appropriate file sizes from Range1 by matching each pair of filenames and types from both ranges.Solution:Use the INDEX and MATCH functions as shown in the following formula:{=INDEX($C$3:$C$7,MATCH(A12&B12,$A$3:$A$7&$B$3:$B$7,0))}(To create Array formula: select the cell after typing the formula,press F2 and then pressCtrl+Shift+Enter)Example:Range1File Name_______File Type_______Size (KB)file1___________xls_____________500file2___________doc_____________80file3___________ppt_____________800file4___________xls_____________400file1___________ppt_____________1200Range2File Name_____________File Type_____________Size (KB) from Range1file1_________________xls___________________500file2_________________doc___________________80file3_________________ppt___________________800file4_________________xls___________________400file1_________________ppt___________________1200Problem:Retrieving the matching price of the item shown in cell A2, for the specific brandentered in cell B2.EXCELTips2.doc 18-04-2012 4
  5. 5. Following are the prices for each possible combination:Item,Brand,PriceJeans, Diesel, $85Jeans, Levis, $80Jeans, Lee, $70T-Shirt, Sacks, $7T-Shirt, Gap, $5T-Shirt, Old Navy, $3Solution:Use the IF and LOOKUP functions as shown in the following formula:=IF(A2="Jeans",LOOKUP(B2,{"Diesel","Lee","Levis";85,70,80}),IF(A2="T-Shirt",LOOKUP(B2,{"Gap","Old Navy","Sacks"},{5,3,7})))Problem:Column B contains the mark matching each of the grades shown in column A.We want to grade each mark in column D by finding the mark closest to it incolumn B, and then retrieving the corresponding grade from column A.Solution:Use the INDEX, MIN, IF, ABS, and ROW functions as shown in the following Arrayformula:{=INDEX($A$2:$A$6,MIN(IF(ABS($B$2:$B$6-D2)=MIN(ABS($B$2:$B$6-D2)),ROW($B$2:$B$6)-ROW($B$2)+1)),1)}To apply Array formula:Select the cell, press and simultaneously press .Problem:Listed in range1 (A4:B6) and range2 (D4:E6) are clothing items and their prices.Cell B9 contains the name of an item from one of the ranges.We would like to perform a lookup on both ranges, find the relevant item, andreturn the matching price.Solution:Use the ISNA and VLOOKUP functions as shown in the following formula:EXCELTips2.doc 18-04-2012 5
  6. 6. =IF(ISNA(VLOOKUP(B9,A4:B6,2,FALSE)),VLOOKUP(B9,D4:E6,2,FALSE),VLOOKUP(B9,A4:B6,2,FALSE))Problem:Columns A & B list all the pay dates of various clients.We want to retrieve the date of the most recent payment made by each of theclients listed in column D.Solution:Use the MAX and IF functions as shown in the following Array formula:{=MAX(IF($A$2:$A$8=D2,$B$2:$B$8))}EXCELTips2.doc 18-04-2012 6
  7. 7. EXCELTips2.doc 18-04-2012 7
  8. 8. How to look up a value in a list and return multiple corresponding values Applies to: Microsoft Office Excel 2003 Look up one value and return one corresponding value Look up one value and return multiple corresponding values Identify row numbers Return corresponding values from column B Remove possible error values In this article, I provide a formula for looking up a value and returning multiple occurrences o corresponding value in a list; for example, if in a two-column list, there appear multiple value name "Ashish" in the first column, the formula returns all of the corresponding values in the second column. Look up one value and return one corresponding value You use the VLOOKUP function to search for a value in the first column of a list and return a same row from another column in the list. Note that the VLOOKUP function is designed to re corresponding value of the first instance of a lookup value. For example, if I type "Ashish" in cell A9, and I type the following VLOOKUP formula in B9: =VLOOKUP(A9,A1:B7,2,FALSE) The VLOOKUP function in cell B9 finds the first occurrence of the name "Ashish", and return corresponding value in the same row of the second column, which is 234. Look up one value and return multiple corresponding values The formula to look up one value and return multiple corresponding values can be stated as row numbers that contain the name "Ashish" in column A, return the corresponding values f remove possible error values. Identify row numbers Enter "Ashish" in cell A10. Then, enter the following array formula (CTRL+SHIFT+ENTER) iEXCELTips2.docthe row number of a corresponding value: determine 18-04-2012 8
  9. 9. EXCELTips2.doc 18-04-2012 9