# Adding Multiple Vectors

February 19, 2005 3:31 PM Subscribe

Mathematical imbecile question: what's the simplest, most universal way to add a list of vectors?

I need a one-size-fits-all formula that I can pop into Excel (or, indeed, an add-in); all my Google searching seems to turn up is high-school methods involving drawing diagrams and measuring angles with a protractor, or a "step-by-step" approach that I can't get my head around moving into a spreadsheet. I just want to be able to put a list of angles and magnitudes in a couple of columns, and come out with the resultant vector at the end.

I need a one-size-fits-all formula that I can pop into Excel (or, indeed, an add-in); all my Google searching seems to turn up is high-school methods involving drawing diagrams and measuring angles with a protractor, or a "step-by-step" approach that I can't get my head around moving into a spreadsheet. I just want to be able to put a list of angles and magnitudes in a couple of columns, and come out with the resultant vector at the end.

In the future, go directly to Mathworld, not Google.

1. Add more columns to turn your polar coordinates into cartesian.

2. Add them

3. Convert back if necessary

posted by vacapinta at 3:39 PM on February 19, 2005

1. Add more columns to turn your polar coordinates into cartesian.

2. Add them

3. Convert back if necessary

posted by vacapinta at 3:39 PM on February 19, 2005

Pseudocode:

Result = (Summation of magnitude*(cosine of angle))

posted by Gyan at 3:40 PM on February 19, 2005

Result = (Summation of magnitude*(cosine of angle))

**i**+ (Summation of magnitude*(sine of angle))**j**.posted by Gyan at 3:40 PM on February 19, 2005

Beautiful, that works like a charm vacapinta, and was pretty obvious. I think the main thing that was confusing me was the need to convert between degrees and radians at various points.

posted by Jimbob at 4:08 PM on February 19, 2005

posted by Jimbob at 4:08 PM on February 19, 2005

Actually, just to sum up exactly what I've done in Excel for anyone else wanting this in the future:

I then calculate the sum of all the rows of column E (call that

posted by Jimbob at 4:17 PM on February 19, 2005

**Column A**: Magnitude**Column B**: Direction, in degrees, clockwise from "North"**Column C**: =90-B**Column D**: =RADIANS(IF(C<0,C+360, C))*Columns C and D convert the angle into radians anti-clockwise from the X-axis.***Column E**: =A*COS(D)**Column F**: =A*SIN(D)I then calculate the sum of all the rows of column E (call that

**X**) and the sum of all rows of column F (call that**Y**)**Angle**=DEGREES(ATAN(**Y**/**X**))**Magnitude**=SQRT(**X**^2+**Y**^2)posted by Jimbob at 4:17 PM on February 19, 2005

No, I lie, calculating that last angle gives the wrong answer. I'll try to work it out.

posted by Jimbob at 4:27 PM on February 19, 2005

posted by Jimbob at 4:27 PM on February 19, 2005

Oh okay, that last angle has to be subtracted from 90 to get it back into "compass" angles, and you add 180 to it if the X-coordinate is negative. Done. Cheers!

posted by Jimbob at 4:38 PM on February 19, 2005

posted by Jimbob at 4:38 PM on February 19, 2005

This thread is closed to new comments.

posted by AlexReynolds at 3:39 PM on February 19, 2005