Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Conditional Formatting with Data Imported from Access.

Conditional Formatting with Data Imported from Access

by Allen Wyatt
(last updated October 26, 2016)

2

Cory is having a problem getting his conditional formatting to work as desired with information imported into Excel from Access. The data being imported in a particular column can either be text (such as "17 U") or numeric (such as 32). The conditional format checks to see if the value in the cell is greater than zero, in which case the value is underlined. This won't work properly with the imported data because not only does Excel treat the text (17 U) as text, but it also treats the numeric (32) as text. This makes sense, since Excel treats the entire column as text rather than changing data format for each cell in the column.

There are a couple of ways you can fix this problem. One is to change the formula you are using in your conditional format. Instead of checking to see if the value is greater than zero, use the following formula (set the conditional check to "Format Is"):

=VALUE(E3) > 0

This formula uses the VALUE function to check what is in cell E3. If the contents are a number—even if it is formatted as text by Excel—then the formula returns True and the condition is met for the formatting. If the contents of E3 really are text (as in "17 U"), then the formula returns a #VALUE error, which does not satisfy the condition and the formatting is not applied.

Another approach is to force Excel to evaluate the imported cells and convert them to numeric values, if appropriate. An easy way to do this is as follows:

  1. After importing the data, select a blank cell from a column outside the range of those you just imported.
  2. Press Ctrl+C. This copies the contents of the cell (nothing) to the Clipboard.
  3. Select the cells that you want evaluated by Excel. For instance, select the column that contains the text values and the numeric values formatted as text.
  4. Display the Home tab of the ribbon.
  5. Click the down-arrow under the Paste tool, and then choose Paste Special. Excel displays the Paste Special dialog box. (See Figure 1.)
  6. Figure 1. The Paste Special dialog box.

  7. Click the Add radio button.
  8. Click OK.

What you just did was to "add" the contents of the Clipboard to all the cells you selected in step 3. If the cells contained real text, then nothing happened to those cells; they remain the same and are still treated as text. If the cells contained a numeric value, then Excel treats it as a number and adds zero to it. This value, as a numeric, is deposited back in the cell, and treated as a real number. This means that the conditional formatting test that you previously set up should work just fine on those cells since they are no longer treated as text.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (5654) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Conditional Formatting with Data Imported from Access.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Determining Page Layout

Getting your document onto paper is the whole purpose of word processing. Here are some concepts that are important when ...

Discover More

Formatting Canadian Postal Codes

Postal codes in Canada consist of six characters, separated into two groups. This tip explains the format and then shows how ...

Discover More

Backing Up Label Layouts

Once you create a custom label layout it is a good idea to backup the layout on a different hard drive in the event of a ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Defeating Automatic Date Parsing

Excel is continually trying to figure out what type of data is being stored in a cell. If it can interpret a value as a date, ...

Discover More

Deleting Unwanted Styles

Custom styles can be a great help in formatting a worksheet. You may, at some point, want to get rid of all the custom styles ...

Discover More

Changing Currency Formatting for a Single Workbook

Currency is formatted differently in different corners of the world. Most formatting uses periods and commas to indicate ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine more than 9?

2016-10-26 18:04:34

Thomson

Here is another way you can write the rule in conditional formating for the same result.

Should work from Excel 2007 onward.

=ISERROR(VALUE(E3))=FALSE


2016-10-26 09:31:50

Shandor

Excel is the world's main workhorse for office work but this case proves it's time to move to more tools like Alteryx or Informatica with user-friendly but robust data transformation & automation functions. These are getting more affordable but need to be still cheaper for mass adoption; maybe Cloud subscriptions to them could do the trick? Coupled to front end reporting apps like Tableau, Spotfire, or a dozen others, this is the office of the future, not brittle spreadsheets with picky formulas and bare bones menus. Just food for thought!


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.