I've worked with colour analysis algorithms and it is not a simple thing to do. In fact, no one has worked out a formula to do this perfectly due to the human eye and it's sensitivity to different colours of the light spectrum among other things.
Large companies that work in this field who develop colour spectrometers, I suspect have large look up tables of real world results along with closely guarded proprietary algorithms to find a close match. Therefore don't expect these machines to be perfect. A well trained eye will often do a lot better with subsequent tests along side the item to be matched. The other problem is that most stores are mixing up larger quantities for automotive use etc. The smaller the batch, the less accurate the mix will be.