The IMCOT function in Excel returns the cotangent of a complex number. You give it something like 4+3i, and it gives you back the cotangent, which is also a complex number.
It’s one of Excel’s engineering functions, so you’ll mostly use it in math, physics, or electrical work. And it saves you from working out the cosine divided by the sine of a complex number by hand.
There are two things that trip people up. The result is text, because Excel stores complex numbers as text, and IMCOT won’t take a whole range of cells unless you add one small character.
In this article, I’ll show you how to use IMCOT with five examples. They cover a single cotangent, a whole column with one formula, separate real and imaginary parts, cleaning up long results, and when the regular COT function is the better choice.
Follow along with the example file
IMCOT Function Examples.xlsx
IMCOT Function Syntax
Here is the syntax of the IMCOT function:
=IMCOT(inumber)
- inumber – The complex number whose cotangent you want.
The inumber argument takes a complex number written as text, like “4+3i” or “4+3j”, or a cell that holds one. When you type it straight into the formula, put it in double quotes, so =IMCOT("4+3i") returns 0.00490118239430447-0.999266927805902i.
The i or j has to be lowercase. A value like “4+3I” isn’t recognized as a complex number, so IMCOT returns the #NUM! error, and the same happens with any other text that isn’t a complex number.
If you point IMCOT at TRUE or FALSE, you get the #VALUE! error instead.
The IMCOT function works in Excel 2013 and later versions, including Excel for Microsoft 365, Excel 2024, 2021, 2019, 2016, and Excel for Mac.
When to Use the IMCOT Function
Use this function when you need to:
- Find the cotangent of a complex number in a math or engineering worksheet
- Check your hand-worked answers for complex trigonometry problems
- Get the cotangent of a whole list of complex numbers with one formula
- Calculate cotangents when the real and imaginary parts sit in separate columns
Let me show you a few practical examples of how to use the IMCOT function.
Example 1: Find the Cotangent of a Complex Number
Let’s start with a simple example.
Below is a problem set with a complex number in each row, and I want to find the cotangent of each one in column C.

Here is the formula to enter in cell C2 and copy down:
=IMCOT(B2)

IMCOT reads the text in B2 as a complex number and returns its cotangent. So for problem 1, 4+3i gives 0.00490118239430447-0.999266927805902i, which matches the result in Microsoft’s own example.
Each result is a complex number too, with a real part and an imaginary part. Excel writes both parts with up to 15 significant digits, which is why the results look so long.
When the input has no real part, like 2i in problem 6 or i in problem 7, the cotangent has no real part either. That’s why those two rows show only an imaginary value, such as -1.31303528549933i.
I’ve kept this first example as a per-row formula so you can see how IMCOT works on one number at a time. The next example handles the whole column with one formula.
Example 2: Get the Cotangent of a Whole Column (j Notation)
In Excel 365 (and Excel 2021 or later), you can find the cotangent of a whole column with a single formula, but IMCOT needs one small trick to do it.
Below is a list of complex numbers written with j instead of i, the way electrical engineers usually write them, and I want the cotangent of each one in column C.

The obvious formula would be to give IMCOT the whole range. I’ve put that attempt in cell F2, and it returns a #VALUE! error:
=IMCOT(B2:B11)

This happens because IMCOT can’t take a multi-cell range reference like B2:B11. It only works with a single value, or with a list of values held in memory (called an array).
Putting a plus sign (+) in front of the range fixes this, because Excel then hands IMCOT the values as an array. Here is the formula that works:
=IMCOT(+B2:B11)

Enter this in cell C2, and it spills the results down to C11. IMCOT also keeps the j, so the cotangent of 1+2j comes back as 0.0327977555337526-0.984329226458191j.
Important: Use just the plus sign here. A double minus (–) also creates an array, but it tries to turn the text into numbers first, so every complex number returns #VALUE!.
The same plus-sign trick works for other functions that won’t spill when you give them a range.
If you are using Excel 2019 or earlier, enter the below formula in cell C2 and then copy it down the range:
=IMCOT(B2)
Example 3: Use COMPLEX Inside IMCOT for Separate Real and Imaginary Parts
Sometimes your data doesn’t have ready-made complex numbers. Instead, the real part and the imaginary part sit in two separate columns as regular numbers.
Below is a list of points with the real and imaginary parts in separate columns, and I want the cotangent of each point in column D.

Here is the formula to enter in cell D2:
=IMCOT(COMPLEX(+B2:B11,+C2:C11))

How this formula works:
- COMPLEX(+B2:B11,+C2:C11) uses the COMPLEX function to join each real part with its imaginary part into a complex number, so point A becomes 1+2i.
- IMCOT(…) returns the cotangent of each of those complex numbers and spills the results down to D11.
The plus signs go on the ranges inside COMPLEX, because the COMPLEX function has the same range limitation as IMCOT. IMCOT itself doesn’t need one here, since COMPLEX already hands it an array.
Point E has 0 as its imaginary part, so it’s just the real number 3, and its cotangent -7.01525255143453 comes back with no imaginary part.
Point F has 0 as its real part, so its cotangent is purely imaginary.
If you are using Excel 2019 or earlier, enter the below formula in cell D2 and then copy it down the range:
=IMCOT(COMPLEX(B2,C2))
Example 4: Round the IMCOT Result
IMCOT always returns every digit it can, which makes the results hard to read and sometimes shows values so small they’re effectively zero.
Below is a list of complex numbers, and I want their cotangents in column B and the same results rounded to 4 decimal places in column C.

Here is the formula to enter in cell B2:
=IMCOT(+A2:A11)

This spills the cotangents down to B11, and most of them have 15 or more digits. The first row is the odd one, since 1+20i returns 7.72603518516115E-18-i.
That E-18 means the real part is about 0.0000000000000000077, which is zero for any practical purpose. When the imaginary part is a large positive number, the cotangent gets extremely close to -i, and IMCOT shows that exact tiny value instead of rounding it to 0.
You can’t clean this up with the ROUND function directly, because the result is text and ROUND returns a #VALUE! error. Instead, round the real and imaginary parts separately and join them back.
Here is the formula to enter in cell C2:
=LET(c,IMCOT(+A2:A11),COMPLEX(ROUND(IMREAL(c),4),ROUND(IMAGINARY(c),4)))

How this formula works:
- IMCOT(+A2:A11) calculates the cotangents, and the LET function stores them as c, so IMCOT runs only once.
- IMREAL(c) and IMAGINARY(c) pull out the real and imaginary parts as regular numbers.
- ROUND(…,4) rounds each part to four decimal places.
- COMPLEX(…) joins the two rounded parts back into a complex number.
Now 1+20i shows a clean -i, and so does 6i, whose cotangent -1.00001228850021i rounds to exactly -i. Every other row is down to four decimals.
The COMPLEX function writes its results with i by default. If your numbers use j, add “j” as a third argument, like COMPLEX(ROUND(IMREAL(c),4),ROUND(IMAGINARY(c),4),"j"), so the results keep the same letter.
Both formulas in this example spill, and the LET function needs Excel 2021 or later. If you are using Excel 2019 or earlier, enter the below formula in cell B2 and then copy it down the range:
=IMCOT(A2)
And for the rounded results, enter the below formula in cell C2 and then copy it down the range:
=COMPLEX(ROUND(IMREAL(IMCOT(A2)),4),ROUND(IMAGINARY(IMCOT(A2)),4))
Example 5: IMCOT vs COT for Regular Numbers
IMCOT also accepts a regular number, since a real number is just a complex number with no imaginary part. But that doesn’t make it the right tool for regular numbers, and this example shows why.
Below is a list of angles in radians, and I want to find their cotangents with the COT function in column B and with IMCOT in column C. Both result columns are formatted to show four decimal places.

Here is the COT formula to enter in cell B2:
=COT(A2:A11)

The COT function spills the cotangents down to B11 as regular numbers, so the four-decimal format works. Unlike IMCOT, COT accepts the range directly, so no plus sign is needed.
Here is the IMCOT formula to enter in cell C2:
=IMCOT(+A2:A11)

The values match COT, but they’re all text. They sit on the left side of the cells, and the four-decimal format is ignored, so you get 1.83048772171245 instead of 1.8305.
Functions that skip text, like the SUM function, will also ignore these results, so you can’t total them the usual way.
In the last row, the cotangent of 0 doesn’t exist, because the sine of 0 is 0 and you can’t divide by zero. COT returns #DIV/0!, while IMCOT returns #NUM!.
IMCOT gives the same #NUM! error for a complex 0 (like “0+0i”) and for an empty cell, which it reads as 0. So if one row of results shows #NUM!, check the input cell in that row for a blank or a zero.
So for regular angles, use COT, and keep IMCOT for numbers that have an imaginary part.
If your angles are in degrees, convert them with the RADIANS function first, because both functions work in radians.
If you are using Excel 2019 or earlier, enter the below formula in cell B2 and then copy it down the range:
=COT(A2)
And for the IMCOT column, enter the below formula in cell C2 and then copy it down the range:
=IMCOT(A2)
So these are some practical ways to use the IMCOT function in Excel to find the cotangent of complex numbers.
Just remember to put a plus sign in front of your ranges when you want one formula for a whole column. I hope you found this article helpful.
Other Excel Articles You May Also Like: