
Tips.Net > ExcelTips Home > Formatting > Conditional Formatting > Conditional Formatting with Data Imported from Access
Summary: If the information you import from Access into Excel isn’t interpreted just right, it can have consequences on your conditional formatting. This tip explains those consequences and how you can correct for any potential problems. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 2003.)
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:
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.
Tip #2418 applies to Microsoft Excel versions: 97 2000 2002 2003
Got the Time? Understanding the ins and outs of working with times and dates can be confusing. Remove the confusion--ExcelTips: Times and Dates is an invaluable resource for learning how best to work with times and dates.
Check out ExcelTips: Times and Dates today!
Have thousands of ExcelTips at your fingertips, on your own system. Answer your own questions or help support others. (more information...)
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site