We have carried out observations toward the W3 complex and G34.3+0.15 using the TRAO14 m radio telescope to examine in detail the chemical variations occurring while molecular clouds evolve from the prestellar to the H II region phase. Observations include spectral surveys of these objects between 84.7 and 115.6 GHz; mapping observations toward W3(OH) with the emissions of CS (2-1), HCN (1-0), HNC (1-0), and HCO+ (1-0); and mapping of CS (2-1) emission toward W3 IRS 5. Chemical model calculations are used to estimate the age of W3(OH) by comparing with the fractional abundances of detected molecules. We found that G34.3+0.15 and W3(OH) are at a similar evolutionary stage, although large differences in the fractional abundances are found in CH3CN and HC3N. Overall, the properties of the detected species and abundances in three regions support the view that chemistry varies as molecular clouds evolve from a cold, collapsing phase to a high-temperature phase, such as the hot core and H II phase. Chemical model calculations for W3(OH) indicate that the evolutionary age of the cloud is 10(4)-10(5) yr with temperature in the range 10-60 K.