Excel Formulas
Excel Formulas
htm
The formula below, for example, returns 1 if cell A1 contains "A". If cell A1 does not contain "A", the formula returns an empty string. =IF(A1="A",1,"") For more decision-making power, you can "nest" IF functions within a formula. In other words, you can use an IF function as the second argument for an IF function. Here's an example: =IF(A1="A",1,IF(A1="B",2,IF(A1="C",3,""))) This formula checks cell A1. If it contains "A", the formula returns 1. If it doesn't contain "A", then the second argument is evaluated. The second argument contains another IF function that determines if A1 contains a "B". If so, the formula returns 2; if not, the
formula evaluates the IF function contained in the second argument and checks to see if A1 contains "C". If so, it returns 3; otherwise, it returns an empty string. Excel allows up to seven levels of nested IF functions. The formula below works correctly, but Excel will not allow you to nest the IF functions any deeper than this. =IF(A1="A",1,IF(A1="B",2,IF(A1="C",3,IF(A1="D",4, IF(A1="E",5,IF(A1="F",6,IF(A1="G",7,IF(A1="H",8,"")))))))) The sections that follow present various ways to get around the limit of seven nested IF functions. Be aware that these techniques may not be appropriate for all situations.
Creating a "Megaformula"
This tip describes how to create what I call a "megaformula" -- a single formula that does the work of several intermediate formulas.
An Example
The goal is to create a formula that returns the string of characters following the final occurrence of a specified character. For example, consider the text string below (which happens to be a URL): http://j-walk.com/ss/books Excel does not provide a straightforward way to extract the characters following the final slash character (i.e., "books") from this string. It is possible, however, do do so by using a number of intermediate formulas. The figure below shows a multi-formula solution. The original text is in cell A1. Formulas in A2:A6 are used to produce the desired result. The formulas are displayed in c olumn B.
Following is a description of the intermediate formulas (which will eventually be combined into a single formula). 1. Count the number of slash characters (Cell A2) The formula in cell A2 returns the number of slash characters in cell A1. Excel doesn't provide a direct way to count specific characters in a cell, so this formula is relatively complex.
2. Replace the last slash character with an arbitrary character (C ell A3) The formula in A3 uses the SUBSTITUTE function to replace the last slash character (calculated in A2) with a new character. I chose CHAR(1) because there is little chance of this character actually appearing in the original text string. 3. Get the position of the new character (Cell A4) The formula in A4 uses the FIND function to determine the position of the new character. 4. Count the number of characters after the new character (Cell A5) The formula in A5 subtracts the position of the new character from the length of the original string. The result is the number of characters after the new character. 5. Get the text after the new character (Cell A6) The formula in A6 uses the RIGHT function to extract the characters -- the end result.
Caveat
Keep in mind that a complex formula such as this is virtually impossible to underst and. Therefore, use this type of formula only when you are absolutely certain that it works correctly and you are sure that you will never need to modify it in the future. Better yet, keep a copy of those intermediate formulas -- just in case.
The steps below are specific to this example. But they can easily be adapted to other types of data transformations.
The COUNT function. Simply counts the number of cells in a range that contain a number. The COUNTA function. Counts the number of non-empty cells in a range. The COUNTBLANK function. Counts the number of empty cells in a range. The COUNTIF function. Very flexible, but often not quite flexible enough. An array formula. Useful when the other techniques won't work.
Formula Examples
Listed below are some formula examples that demonstrate various counting techniques. These formula all use a range named data. To count the number of cells that contain a negative number: =COUNTIF(data,"<0") To count the number of cells that contain the word "yes" (not case sensitive): =COUNTIF(data,"yes") To count the number of cells that contain any text: =COUNTIF(data,"*") To count the number of cells that contain text that begins with the letter "s" (not case-sensitive): =COUNTIF(data,"s*") To count the number of cells that contain the letter "s" (not case-sensitive): =COUNTIF(data,"*s*") To count the number of cells that contain either "yes" or "no" (not casesensitive): =COUNTIF(data,"yes")+COUNTIF(data,"no") To count the number of three-letter words: =COUNTIF(data,"???") To count the number of cells that contain a value between 1 and 10: =COUNTIF(data,">=1")-COUNTIF(data,">10") To count the number of unique numeric values (ignores text entries): =SUM(IF(FREQUENCY(data,data)>0,1,0)) To count the number of cells that contain an error value (this is an array formula, entered with Ctrl+Shift+Enter): =SUM(IF(ISERR(data),1,0))
Overview
The topic of "protecting" a spreadsheet receives a great deal of attention in the Excel newsgroups. This document provides answers to some common questions. Excel provides three primary ways to protect information in a spreadsheet: Worksheet Protection Workbook Protection VB Project Protection
Worksheet Protection
Questions in this section deal with protecting the contents of cells and objects on a worksheet.
I tried the procedure outlined above, and it doesn't let me change any cells! I only want to protect some of the cells, not all of them.
Every cell has two key attributes: Locked and Hidden. By default, all cells are locked, but they are not hidden. Furthermore, the Locked and Hidden attributes come into play only when the worksheet is protected. In order to allow a particular cell to be changed when the worksheet is protected, you must unlock that cell.
I made some cells hidden and then protected the worksheet. But I can still see them. What's wrong?
When a cell's Hidden attribute is set, the cell is still visible. However, it's contents do not appear in the Formula bar. Making a cell Hidden is usually done for cells that contain formulas. When a formula cell is Hidden and the worksheet is protected, the user cannot view the formula.
I protected my worksheet, but now I can't even do simple things like sorting a range. What's wrong?
Nothing is wrong. That's the way worksheet protection works. Unless you happen to be using Excel 2002.
Can I lock cells such that only specific users can modify them?
Yes, but it requires Excel 2002.
How can I find out more about the new protection options available in Excel 2002?
Start with Excel's Help system. If you're a VBA programmer, you may be interested in this MSDN article that discusses the Protection object.
Can I set things up so my VBA macro can make changes to Locked cells on a protected sheet?
Yes, you can write a macro that protects the worksheet, but still allows changes via macro code. The trick is to protect the sheet with the UserInterfaceOnly parameter. Here's an example: ActiveSheet.Protect UserInterfaceOnly:=True After this statement is executed, the worksheet is protected -- but your VBA code will still be able to make changes to locked cells and perform other operation that are not possible on a protected worksheet.
OK, I protected my worksheet with a password. Now I can't remember the password I used.
First, keep in mind that password are case-sensitive. If you entered the password as xyzzy, it won't be unprotected if you enter XYZZY. Here's a link to a VBA procedure that may be able to derive a password to unprotect the worksheet. This procedure has been around for a long time, and is widely available -so I don't have any qualms about reproducing it here. The original author is not known. If that fails, you can try one of the commercial password-breaking programs.
Can I prevent someone from copying the cells in my worksheet and pasting them to a new worksheet?
Probably not. If someone really wants to copy data from your worksheet, they can find a way.
Workbook Protection
Questions in this section deal with protecting workbooks.
The Save Options dialog box (described above) also has a "Password to modify" field. What's that for?
If you enter a password in this field, the user must enter the password in order to overwrite the file after making changes to it. If the password is not provided, the user can save the file, but he/she must provide a different file name.
VB Project Protection
How can I prevent others from viewing or changing my VBA code?
If you use Excel 97 or later... Activate the VB Editor and select your project in the Projects window. Then choose Tools - xxxx Properties (where xxxx corresponds to your Project name). In the Project Properties dialog box, click the Protection tab. Place a checkmark next to Lock project for viewing, and enter a password (twice). Click OK, then save your file. When the file is closed and then re-opened, a password will be required to view or modify the code.
Description:
The Cell Math add-in provides an easy way to modify cells without using formulas. Some of the functionality of Cell Math is available through Excel's Paste Special command (with the Add, Subtract, Multiply, or Divide option), but Cell Math is much more versatile and easier to use.
Features: Perform common mathematical operations: addition, subt raction, multiplication, division. For example, you can use Cell Math to increase all cells by 5% (see the figure above). Input the operand manually, or use the value in a cell or named cell. Perform exponentiation (not possible with Paste Special) Apply rounding to cells (for example, round the values in all cells to two decimal places). Apply an Excel function (such as SIN or SQRT) to each value in a range. Use the Custom option to apply any mathematical operation that can be expressed as an Excel formula. As an option, create formulas from the value cells. As an option, perform the operation on existing formula cells (the formulas are modified accordingly). Your dialog box settings are saved and recalled automatically, making it easy to apply the same operation to multiple ranges. A progress bar displays the progress of the operation. The results of the mathematical operations can be undone.
Pricing: The Cell Math add-in is free. No strings attached. No nag messages. No time limit. This add-in requires Excel 97 or Excel 2000, and it will not work with Excel 5 or Excel 95.
Installation:
1. Download the J-Walk Cell Math add-in (180K) . It's a self-extracting EXE file. 2. Double-click the cellmath.exe file. You can then extract the cellmath.xla add-in file to a directory of your choice. 3. Start Excel and select the Tools - Add-Ins command. 4. In the Add-Ins dialog box, click the Browse button and locate cellmath.xla (the file you extracted in Step #2).
5. Click OK 6. Activate your workbook. 7. Select Tools - J-Walk Cell Math from the menu.
at a cell or range reference. In your case, assume that cell B1 on your summary worksheet holds the month name. The following formula utilizes the INDIRECT function to create the range reference used by the SUM function: =SUM(INDIRECT(B1&"!F1:F10")) Note that I use the ampersand operator to join the month name with the cell reference (expressed as text). Refer to the figure below. If cell B1 contains the text March, the SUM function returns the sum of the range March!F1:F10.
blank cell. Select the cell and choose Edit, Copy. Then select the range of values and choose Edit, Paste Special. Choose Multiply and click OK. Then delete the cell that contains the 1.05. If you need to do this sort of thing frequently, you may want to download a copy of my Cell Math add-in (free). More information about the Cell Math Add-In
Description:
The Cell Math add-in provides an easy way to modify cells without using formulas. Some of the functionality of Cell Math is available through Excel's Paste Special command (with the Add, Subtract, Multiply, or Divide option), but Cell Math is much more versatile and easier to use.
Features: Perform common mathematical operations: addition, subtraction, multiplication, division. For example, you can use Cell Math to increase all cells by 5% (see the figure above). Input the operand manually, or use the value in a cell or named cell. Perform exponentiation (not possible with Paste Special) Apply rounding to cells (for example, round the values in all cells to two decimal places). Apply an Excel function (such as SIN or SQRT) to each value in a range. Use the Custom option to apply any mathematical operation that can be expressed as an Excel formula. As an option, create formulas from the value cells. As an option, perform the operation on existing formula cells (the formulas are modified accordingly). Your dialog box settings are saved and recalled automatically, making it easy to apply the same operation to multiple ranges. A progress bar displays the progress of the operation.
Pricing: The Cell Math add-in is free. No strings attached. No nag messages. No time limit. This add-in requires Excel 97 or Excel 2000, and it will not work with Excel 5 or Excel 95.
Installation:
1. Download the J-Walk Cell Math add-in (180K) . It's a self-extracting EXE file. 2. Double-click the cellmath.exe file. You can then extract the cellmath.xla add-in file to a directory of your choice. 3. Start Excel and select the Tools - Add-Ins command. 4. In the Add-Ins dialog box, c lick the Browse button and locate cellmath.xla (the file you extracted in Step #2). 5. Click OK 6. Activate your workbook. 7. Select Tools - J-Walk Cell Math from the menu.
The formula in cell H4 looks up the entries in cells H2 and H3 and then returns the corresponding value from the table. The formula in H4 is: =INDEX(A1:E14, MATCH(H2,A1:A14,0), MATCH(H3,A1:E1,0)). The formula uses the INDEX function, with three arguments. The first is the entire table range (A1:A14). The second uses the MATCH function to return the offset of the desired
month in column A. The third argument uses the MATCH function to return the offset of the desired product in row 1. You may prefer to take advantage of Excel's natural-language formulas. For example, enter the following formula to return Sprocket sales for June: =June Sprockets If natural-language formulas aren't working, select Tools, Options, click the Calculation tab, and place a c heck mark next to "Accept labels in formulas." Be aware that using natural language formulas is not 100% reliable!
Q. I need to calculate the sum of the three largest values in a range of 100 cells. The range isn't sorted, so I can't use a SUM function. Do you have any suggestions about how I could handle this problem? Excel's LARGE function returns the nth-largest value in a range, in which n is the function's second argument. You need a formula that calls the LARGE function three times and then sums the results. The following formula, which assumes the numbers are located in the range A1:A100, will do the job: =LARGE(A1:A100,1)+ LARGE(A1:A100,2)+ LARGE(A1:A100,3) Another approach is to use an array formula like this one: =SUM(LARGE(A1:A100,{1,2,3})) The formula first passes an array of three values to the LARGE function, and then uses the SUM function to add the values returned by the LARGE function. Notice that the values 1 through 3 are enclosed in brackets rather than parentheses. After typing an array formula, press Ctrl-Shift-Enter instead of Enter. Formulas of this type can become unwieldy as n gets larger. For example, to sum the top 30 values in a range, a formula must contain a list of integers from 1 to 30. Here is a more general version of the array formula: =SUM(LARGE(A1:A100,ROW(INDIRECT ("1:30")))) This formula uses the ROW function to generate a series of integers between 1 and 30, and uses this array as the second argument for the LARGE function. To sum a different quantity of numbers, just change the 30 to the desired number.
To create this type of message box for your worksheet: 1. Select the cells for which you need to punch in unique entries (here, the correct range to select is A2:A20). 2. Choose Data, Validation and click the Settings tab. 3. Choose Custom from the Allow drop-down list. The Custom option requires a logical formula that will return either "True" or "False." This example requires a formula that will return "True" only if the content of the cell does not match one that already exists in the range. The COUNTIF function will do the job. Type the following formula into the Formula field: =COUNTIF($A$2:$A$20,A2)=1 This formula counts the number of cells in range A2:A20 that contain the same value that appears in cell A2. If the count is 1, the formula returns "True"; otherwise, it returns "False." Notice that the first argument for COUNTIF is an absolute reference to the entire validation range. In contrast, the second argument is a relative reference to the upper left cell in the validation range (it will be adjusted for each of the other cells in the range). 4. Next, to create the warning that appears in a pop-up message box when a duplicate value is entered into the selected range, click the Error Alert tab in the Data Validation dialog box. For the Style, select Stop (this option rejects existing values). Enter a title for the message box (such as Duplicate Data) and type your error message. 5. Click OK and try it out. You'll find that you can enter any data into the validation range, but if you type an entry that already exists, you'll get the warning message. Click Retry to edit the cell's contents or choose Cancel to clear the cell.
While Data Validation is a useful feature, it contains a potentially serious design flaw. If you copy a cell and paste it to a cell that uses the feature, the Data Validation rules are wiped out. This problem also applies to cells that use Conditional Formatting. You'll need to keep this in mind when you're cutting and pasting in mission-critical applications.
Note: Be careful if you plan to insert dates that occurred before 1752. Differences between the historical American, British, Gregorian, and Julian calendars can result in inaccurate computations.
Applications:
The XDate add-in is particularly useful for genealogists and others who need to perform simple calculations using pre-1900 dates. The figure below, for example, shows the XDATEYEARDIF function being used to calculate ages.
Requirements:
The XDate add-in requires Excel 97 or later. A version for Excel/Macintosh is also available.
Limitations:
Be careful if you use dates prior to 1752. Differences between the historical American, British, Gregorian, and Julian calendars can result in inaccurate computations.
Note:
PUP v5 also includes the XDATE functions. However, they are not packaged in an add-in. Rather, you can add the functions directly to the VBA project for your workbook. As a result, you can distribute the workbook without a dependent add-in.
Free Download:
This add-in is fully functional, not crippled, and has no nag messages. It's absolutely free, with no strings attached. Click the link below to go to the download page. Download the XDate Add-In For Windows (an EXE file) Download the XDate Add-In For Macintosh (a SIT file)
Documentation:
Complete context -sensitive online help is included (Windows version only).
1. Extract the files Download and execute the xdate.exe file to extract the XDate files. You can put the files into any directory. 2. Install the add-in Start Excel 97 (or later version) and select the Tools - Add-Ins command. In the Add-Ins dialog box, click the Browse button and locate xdate.xla (the file you extracted in Step #2). Click OK You can type the functions manually, or use Excel's Paste Function dialog box. To access the Paste Function dialog, click the Paste Function button, or select Insert - Function. The XDate Functions are listed in the 'Date & Time' Category. When a function is selected in the Paste Function dialog, press F1 to read the online help.
Technical Support:
To report a problem with the XDate add-in for Windows, contact J-Walk & Associates via email. [email protected]
Column A consists of formulas that refer to column B. The formula in cell A1 is: =IF(B1<>"",COUNTA($B$1:B1)&".","") This formula, which is copied down to the ot her cells in column A, displays the next consecutive item number if the corresponding cell in column B is not empty. If the cell in column B is empty, the formula displays nothing. As items are added or deleted from column B, the numbering updates automatically.
The figure below shows the FilterCriteria in action. The function is used in the cells in row 1. For example, cell A1 contains this formula: =FilterCriteria(A3) As you can see, the list is currently filtered to show rows in which column A contains January, column C contains a code of A or B, and column D contains a value greater than 125 (column B is not filtered, so the formula in cell B1 displays nothing). The rows that don't match these criteria are hidden.
6. Select Format, Conditional Formatting 7. In the Conditional Formatting dialog box, select Formula Is from the drop-down list, and then enter this formula in the adjacent box (see the figure below): =CellHasFormula 8. Click the Format button and select the type of formatting you want for the cells that contain a formula. 9. Click OK. After you've completed these steps, every cell that contains a formula and is within the range you selected in Step 4 will display the formatting of your choice.
How does it work? The key component is creating a named formula in Steps 2 and 3. This formula, unlike standard formulas, doesn't reside in a cell, but it still acts like a formula by returning a value -- in this case either 'True' or 'False'. The formula uses the GET.CELL function, which is part of the XLM macro language (VBA's predecessor) and cannot be used directly in a worksheet. Using a value of 48 as the first argument for GET.CELL causes the function to return 'True' if the cell contains a formula. The INDIRECT function essentially creates a reference to each cell in the selected range.
The formula will return the number of corresponding cells that are different. If the formula returns 0, it means that the two ranges are identical.
Next, you need to type a DOS command to generate the file list. For example, if you would like to generate a list of all files in the root directory of drive D, type the following at the command prompt and press Enter:
dir d:\ To list the files in a particular directory, add the directory name after the drive: dir d:\my files\ The file names will be listed in the window. Usually, you'll want these files to be sent to a file. To redirect the output to a file, use the > character and specify a file name. For example, to send the file names to a text file named filelist.txt in the root directory of drive C, use this command: dir d:\ >c:\filelist.txt If you would like the file list to include the files in all subdirectories of drive D, use the /s switch: dir d:\ /s >c:\filelist.txt The directory listing will contain lots of additional information. To get the file names only (bare format), use the /b switch: dir d:\ /s /b >c:\filelist.txt To find out about other options available for the DIR command (such as including file dates and times), type this command: dir /? After the text file is generated, you can import it into Excel by using the File - Open command. NOTE: If you need do this on a regular basis, you may be interested in this article from Microsoft , which describes how to create a batch file that lists file names in Notepad
2. Your Alternate startup directory. Select Tools - Options. In the Options dialog box, click the General tab. Locate the setting called At startup, open all files in. If this field is not empty, delete its contents.
The first list is in A2:B19, and this range is named OldList . The second list is in D2:E19, and the range is named NewList . The ranges were named using the Insert - Name Define command. Naming the ranges is not necessary, but it makes them easier to work with. As you can see, items in OldList that do not appear in NewList are highlighted with a yellow background. Items in NewList that do not appear in OldList are highlighted with a green background. These colors are the result of Conditional Formatting.
How to do it
1. Start by selecting the OldList range. 2. Choose Format - Conditional Formatting 3. In the Conditional Formatting dialog box, use the drop-down list to choose Formula is . 4. Enter this formula: =COUNTIF(NewList,A2)=0 5. Click the Format button and specify the formatting to apply when the condition is true (a yellow background in this example). 6. Click OK
The cells in the NewList range will use a similar conditional formatting formula. 1. Select the NewList range. 2. Choose Format - Conditional Formatting 3. In the Conditional Formatting dialog box, use the drop-down list to choose Formula is . 4. Enter this formula: =COUNTIF(OldList,D2)=0 5. Click the Format button and specify the formatting to apply when the condition is true (a green background in this example). 6. Click OK Both of these conditional formatting formulas use the COUNTIF function. This function counts the number of times a particular value appears in a range. If the formula returns 0, it means that the item does not appear in the range. Therefore, the conditional formatting kicks in and the cell's background color is changed. The cell reference in the COUNTIF function should always be the upper left cell of the selected range.
How to do it
The solution to creating this "reverse pivot table" is to use a pivot table! The steps below are specific to the example data shown, so you'll need to modify them slightly to work with your data.
Part 2: Finishing up
At this point, you will have a small pivot table that shows only the sum of all values:
1. Double-click the cell that contains the total (outlined in yellow, above). Excel will create a new sheet that displays the original data in the form of a database table (see the figure below). 2. The column headings will display generic descriptions (Row, Column, and Value), so you'll probably want to change these headings to make them more descriptive.
A VBA Macro to do it
If you do this sort of thing on a regular basis, you may prefer to use a VBA macro . Just copy the VBA code to a VBA module. Then activate a cell in your summary table and execute the MakeDataBaseTable macro. Option Explicit Sub MakeDataBaseTable() Dim SummaryTableRange As Range Dim PivotTableSheet As Worksheet Set SummaryTableRange = ActiveCell.CurrentRegion If SummaryTableRange.Count = 1 Or SummaryTableRange.Rows.Count < 3 Then MsgBox "Select a cell in the summary table.", vbCritical Exit Sub End If ActiveWorkbook.PivotCaches.Add _ (SourceType:=xlConsolidation, _ SourceData:=Array(SummaryTableRange.Address(True, True, xlR1C1, True))) _ .CreatePivotTable TableDestination:="", _ TableName:="PivotTable1" Set PivotTableSheet = ActiveSheet With PivotTableSheet .PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1) .PivotTables("PivotTable1").DataPivotField.PivotItems("Sum of Value").Position = 1
.PivotTables("PivotTable1").PivotFields("Row").Orientation = xlHidden .PivotTables("PivotTable1").PivotFields("Column").Orientation = xlHidden End With Range("B4").ShowDetail = True Application.DisplayAlerts = False PivotTableSheet.Delete Application.DisplayAlerts = True End Sub
If you need more rows, you might want to consider using a database (such as Access) or another spreadsheet (Quattro Pro can handle a million rows) for data storage. In most cases, you probably don't need to work with all of your data at once. You'll usually need only a subset of your data. You can use Excel's Data, Get External Data command to query the database and bring in only the records you need.
Private Sub Workbook_Open() Worksheets("Sheet1").EnableSelection = xlUnlockedCells End Sub This macro executes whenever the workbook is opened, and sets the EnableSelection property of Sheet1 to xlUnlockedCells. The technique can be circumvented by changing the EnableSelection property to its default value (xlNoRestrictions). Few users know about this dodge, however.
To view the actual document, Click here . The interactive document will appear in a new browser window. You can change the year in cell C3 and the sheet will update automatically. The sheet isn't protected,o you can even examine the formulas. Because there's no formula bar, you will have to press F2 to view the formula in the active cell. To view an interactive Excel file, you need Internet Explorer 4.01 or later, and Microsoft Office Web Components (included wit h most versions of Office 2000 and later) must be installed on your system. Note: If you have Excel 2000 installed on your system and you receive an error message when attempting to view an interactive spreadsheet on the Web, check your version of the software. For reasons known only to Microsoft, the Office Web components aren't included with the Small Business Edition of Office 2000 or with the stand-alone version of Excel 2000. In other words, your copy of Excel 2000 may be lacking one of the key selling points of the product. According to Microsoft, you can legally install the Office Web Components if you own Office 2000 Small Business Edition and if someone in your organization has a license for Microsoft Office 2000 Premium, Professional, or Standard, or Microsoft Access 2000. If you have only the stand-alone version of Excel, you cannot install the Web Components.
tabs until they're the size you want. Be aware that this setting affects the scroll bars in all your applications.
Excel imports the text file as a database query, which you can update if the data in the text file changes (select Data, Refresh Data to do so). To import the file as static data, c lick Properties in the Import Data dialog, and remove the check mark from the "Save query definition" box.
Note: If you're using Excel 2002, you can turn automatic hyperlinks on or off in the AutoCorrect dialog box Surprisingly, Excel doesn't provide a direct way to remove all hyperlinks on a worksheet. In fact, the only way to accomplish this is one cell at a time: Activate the cell that contains the hyperlink, right-click, and then select Hyperlink, Remove Hyperlink. Unfortunately, this command is available only when you have selected a single cell. To quickly deactivate all hyperlinks, you need to use a macro. To create the macro, press Alt-F11 to activate the Visual Basic Editor, select Insert, Module to insert a new VBA module into your project, and then enter the following code: Sub ZapHyperlinks() Cells.Hyperlinks.Delete End Sub When you execute the ZapHyperlinks macro, all hyperlinks on the active sheet are deleted and replaced with normal text.
Select Tools, Macro, Macros to display the Macros dialog box. Type CreateShortcuts in the Macro Name field and click Create. Then enter the following macro into the VBA module, and press Alt-F11 to return to Excel. Sub CreateShortcuts() ItemCount = Application.CountA(Range("Sheet1!A:A")) For Row = 1 To ItemCount ShortText = Cells(Row, 1) LongText = Cells(Row, 2) Application.AutoCorrect.AddReplacement ShortText, LongText Next Row End Sub Save the workbook and distribute it to your coworkers. To add the AutoCorrect shortcuts, open the workbook, select Tool, Macro, Macros, and then execute the CreateShortcuts macro. Be aware that existing shortcuts with the same name will be overwritten without warning.
1. Select File, Open 2. Locate the file to be imported 3. Hold down Shift while you click Open Note: When you import a file with a .csv extension, the Text Import Wizard won't kick in. To override this default, you need to change the file's extension from .csv to .txt.