Many things can change your final cost. The type of water heater is one big part. The national range above is for a tank water heater. Tankless models often cost more. The size of the unit also matters. How hard the job is affects labor costs. This includes removing your old unit. It also covers any needed plumbing updates.
Always get a few quotes from local pros. Ask what each quote includes. This helps you compare prices fairly. Make sure it covers parts and labor. Also ask about any permits needed. Planning ahead helps you budget well.