30 October, 2009

Clean imported Excel data

Sometimes when I get data from systems in CSV format, it includes a leading apostrophe ('). When viewing the data in a cell, the apostrophe does not appear, but when I look at it in the formula bar, it does. Without removing the leading apostrophe, any comparisons come up false.

I tried removing the first character, but it removed the first displayed character. If you have a numeric field, you can divide the it by 1 (=c2/1), but that doesn't solve the problem for text fields. The solution is a built-in function Clean: =CLEAN(C2).

No comments: