 Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Strange ATAN Results.

# Strange ATAN Results by Allen Wyatt
(last updated October 24, 2015)

Jerry notes that when he uses the ATAN function in Excel to calculate an arctangent, he gets a result that's quite a bit different from the result provided when he uses a scientific calculator to derive the arctangent. This makes him wonder if there is something strange in how the ATAN function works.

There are two possibilities here. The most likely possibility is that your calculator defaults to using degrees in trigonometric functions such as calculating an arctangent. Excel uses radians exclusively. For example, let's say you wanted to calculate the arctangent for 0.5. If you plug this into your calculator, and your calculator is working in degrees, you'll get a rounded result of 26.565. However, using the ATAN function in Excel produces a rounded result of 0.464.

The result that Excel provides is in radians, and when you convert that result to degrees, you end up with 26.565—the same as your calculator's result. Here's how you can easily do the conversion:

```=DEGREES(ATAN(0.5))
```

If the angle for which you want to find the arctangent is expressed in degrees instead of radians, then you'll need to do the conversion on the input:

```=ATAN(RADIANS(30))
```

Again, remember that the result of the ATAN function is always in radians, so you may also want to do a conversion on the output, as well.

The solution is to make sure that your calculator is working in radians mode, which should give you the same results as Excel. Either that or you need to convert Excel's results (and, possibly, input) to degrees, as shown above.

The other possibility is much less likely, but it is worth mentioning: There are some values for which the ATAN function will break down, but for which your calculator may already compensate. The best explanation of the scenarios under which this could happen is provided in this Wikipedia article:

```http://en.wikipedia.org/wiki/Atan2
```

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11437) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Strange ATAN Results.

##### Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

##### MORE FROM ALLEN

Erroneous Table Math

Depending on the type of data you have in your table, the SUM(ABOVE) function might return incorrect results. Here's an ...

Discover More

Make your money last longer by using your head when printing labels. Here's a great example of how you can double the ...

Discover More

Checking for Duplicate Rows Based on a Range of Columns

When working with data in Excel, you might want to figure out which rows of data represent duplicates of other rows. If ...

Discover More Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

##### More ExcelTips (ribbon)

Understanding the VLOOKUP Function

Functions are at the heart of Excel's power in working with data. One of the most misunderstood functions provided by ...

Discover More

Counting Displayed Cells

When you filter data, Excel displays only a portion of what is really in a worksheet. If you want to count the number of ...

Discover More

Using the ABS Function

Need to find the absolute value of a number? That's where the ABS function comes into play.

Discover More
##### Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 0 + 6?

2016-08-11 17:41:41

Don

YEP! Your formula works P E R F E C T L Y!!! I've been working on this for over 2 weeks. You solved it in two days!! I really do appreciate your help, Rod. Now I can move on to completing this project. T H A N K S, A G A I N Ron and thumbs up!

Don

2016-08-10 06:01:13

Rod Grealish

Don,

I have found a formula at http://www.mrexcel.com/forum/excel-questions/559852-rgb-hue-formula.html

=IF(180/PI()*ATAN2(2*B2-C2-D2,SQRT(3)*(C2-D2))<0,180/PI()*ATAN2(2*B2-C2-D2,SQRT(3)*(C2-D2))+360,180/PI()*ATAN2(2*B2-C2-D2,SQRT(3)*(C2-D2)))

(The semi-colons in the original need to be replaced by commas). The formula gives a divide by zero (#DIV/0!) error when all the rgb values are equal.

Your formala appears to be part of the above formula where 1.732.. is SQRT(3) and 57.295... is 180/PI().

Rod

2016-08-07 19:08:26

Don

Hi Rod...

Thanks for the reply. I tried reordering the cells; but, still haven't resolved this problem. Not being a math wiz; I'm somewhat stumped.

I grabbed the formula from a website:
ATAN2(1.732050808*(C2-D2),(2* B2-C2-D2))*57.295779513
B2 = Red = 251
C2 = Green = 252
D2 = Blue = 247
Result in column E2 = 19.10660534643070

I used ColorMania (v5.1) Color Picker to check my work. It says that Hue should equal 72 degrees.

2016-08-06 13:12:14

Rod Grealish

Don,

This seems to be a problem in colour theory. Cells B1, C1 and D1 seem to contain rgb values. If 19 and 72 are approximate values for the angles I assume the 'exact' values add up to 90. This would suggest that a sign is incorrect in the formula, or possibly the rgb values are in an incorrect order. What are the expected and actual hue angles when other rgb values are used?

Rod

2016-08-05 19:14:13

Don

Ops! I forgot to tell you what Cells B1,C1, and D1 equate to:
B1 = 251
C1 = 252
and
D1 = 247

2016-08-05 19:10:07

Don

FINDING HUE ANGLE

I'm using this formula:

=ATAN2(1.732050808*(C1-D1),(2* B1-C1-D1))*57.295779513

and getting:

19.1066053464307000

The HUE Angle should be approx. 72 degrees NOT 19 degrees

What am I doing wrong?

##### This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.