Recognising a date and number

MrOllyR

New Member
Joined
Jun 24, 2020
Messages
24
Office Version
  1. 365
Platform
  1. Windows
I've noticed that we can't predict the quality of the data we need if it has been received from multiple sources. Trailing spaces, non-printing characters, upper case only text, etc. I'm putting together a spreadsheet tool which cleans data so it can be collated and usable.

On sheet 1, data can be entered, and a nested formula 'cleans' the data on sheet 2, before VBA gets rid of the formula to paste the values.

The problem I have is because sheet 2 is set to general, it doesn't recognise dates and numbers. It sees everything as text but prompts me that there is a problem when it recognises that data isn't text.

Is there a way to ensure that Excel recognises a date as a date and a number as a number? That is, without having to go through the manual process of changing the format.

Any help would be much appreciated.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I've noticed that we can't predict the quality of the data we need if it has been received from multiple sources. Trailing spaces, non-printing characters, upper case only text, etc. I'm putting together a spreadsheet tool which cleans data so it can be collated and usable.

On sheet 1, data can be entered, and a nested formula 'cleans' the data on sheet 2, before VBA gets rid of the formula to paste the values.

The problem I have is because sheet 2 is set to general, it doesn't recognise dates and numbers. It sees everything as text but prompts me that there is a problem when it recognises that data isn't text.

Is there a way to ensure that Excel recognises a date as a date and a number as a number? That is, without having to go through the manual process of changing the format.

Any help would be much appreciated.
Have you tried using "Text to Columns"?
You can only do it one column at a time (though you can have VBA loop through each column), but it is a good tool for converting numbers and dates that have been entered as text to the numbers and dates. Note that in the third argument, if you leave it set to "General", it might guess correctly, and differentiate dates from numbers when converting (though Excel actually stores dates as numbers with special formats, so dates REALLY are numbers in Excel).
 
Upvote 0
Solution
Have you tried using "Text to Columns"?
You can only do it one column at a time (though you can have VBA loop through each column), but it is a good tool for converting numbers and dates that have been entered as text to the numbers and dates. Note that in the third argument, if you leave it set to "General", it might guess correctly, and differentiate dates from numbers when converting (though Excel actually stores dates as numbers with special formats, so dates REALLY are numbers in Excel).
Thank you for your reply. I've tried this and it's more trouble than it's worth in terms of applicability. Instead, I've started again from scratch and created a series of macros to clean and trim data without altering the number format. Thank you anyway!
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,517
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top