Data Integrity

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
The equally vague answer is: you check it as soon as it's available to you - as it's entered at the keyboard, before you import it from disk, before you export it from the database, etc.

Where exactly is your data coming from?


There are normally three levels of checking when you're validating data:-
  • Error: data which is incorrect in its own right, such as a numeric digit in someone's name (although the way names are going these days, it won't be too long!); an invalid date (1st Octember or 39th March); a non-existent postcode, etc.
  • Compatibility: the data is incorrect because it's incompatible with something else, for example you've asked someone to enter their date of birth and their age, or town and postcode, and the two don't agree.
  • Warning: the data appears to be unusual in some way but it might be valid, for example a student sitting a GCSE exam might state his age as 10 - unusual but not impossible - or provide a foreign postcode because he doesn't live in the UK.
You should submit your data to all three levels of checking.

Never assume that data will be correct unless you can absolutely guarantee that the source of the data is 100% reliable. In particular never trust data which has been produced by a human because they are notoriously unreliable and sometimes even maleficent creatures, and when confronted by a prompt for a name, date, telephone number or postcode, they will one day, inevitably, type in a very rude word, just to see what the system does.

When presented with a userform they will try to save an incomplete or completely empty record, or press Escape, Ctrl-Break, or any other key combination they reckon might provide some light relief whilst they're waiting for their next coffee break. When faced with a worksheet they will rename the individual sheets, change the file name, mess around with the lookup tables, insert and delete rows and columns, merge cells, modify column headings, change colours and number formats - in fact they will attempt to do anything which will render your carefully-crafted code totally and utterly useless.

When processing data of uncertain reliability, it's often the case that 80% of your code is dedicated to ensuring that the data is valid to start with and coping with the consequences of it not being quite what you were anticipating.

I hope this helps in a general sort of way. The more information you provide us with, the more guidance we can give you in return.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

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