Base stud formula
For a simple straight wall, divide wall length in inches by on-center spacing, round up, and add an end stud. Then add framing for corners, intersections, openings, and backing.
Take off openings individually
Each door and window can require kings, jacks, cripples, sills, and a designed header. Do not assume the opening simply subtracts studs.
Verify the assembly
Check structural plans, local code, species and grade, load paths, fire blocking, treated-lumber requirements, and hardware before ordering.