Magnetic sensor AbstractA magnetic sensor for determining positions of an activation magnet along a monitored distance with at least two sensor elements. Both sensor elements are subjected to at least one component of a magnetic field ofthe activation magnet. An evaluation unit coupled to the sensor element generates at least one switching element that corresponds to a desired magnet position. Each sensor element is operative over the entire monitored distance, and for each desired magnet position there is one unambiguous group of signal values which is used by the sensor elements for generating the switching signals in the evaluation unit.