The two speed switch has four color wires (red, white, blue, yellow). The motor has five wires (red, white, blue, yellow and black). The switch has two black wires. The cord has one black and one white wire. If you have a power nozzle receptacle, it also has two black wires.
First, join the white 2 speed switch wire to the white motor wire.
Second, join the blue 2 speed switch wire to the blue motor wire.
Third, join the yellow two speed switch wire to the yellow motor wire.
Forth, join the red 2 speed switch wire to the red motor and the white cord wire. (if you have a power nozzle receptacle, join one black wire to the above).
Fifth, join the black motor wire to the black switch wire
(if you have a power nozzle receptacle, join the remaining black wire to the above)
Six, join the remaining black switch wire to the remaining black cord wire.
That's it.
If you have a power nozzle receptacle, three of your wire connectors are larger than the other. The smaller wire connectors are used with the 2 wire connection, the larger connectors are used with the connections of 3 or more wires. The largest wire connector (wire nut) is used with the Forth connection.
For any single speed vacuum, the connections are as follows:
One cord wire to one switch wire
One motor wire to one switch wire
One motor wire to one cord wire