IMCSC Function in Excel

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

The IMCSC function in Excel returns the cosecant of a complex number, which is 1 divided by the sine of that number. So if you give it 2-i, it gives you back another complex number, 0.6354937992539-0.221500930850509i.

It’s mostly used in math and engineering work, where numbers have a real part and an imaginary part. Excel has no number type for these, so IMCSC takes a complex number as text (like “2-i”) and returns its answer as text too.

One catch is that IMCSC doesn’t accept a range directly, so pointing it at a whole column returns a single #VALUE! error.

In this article, I’ll show you how to use IMCSC with five examples, including how to get the cosecant of a whole column with one formula and how to fix the #NUM! errors you’ll run into.

Follow along with the example file

IMCSC Function Examples.xlsx

Download

IMCSC Function Syntax

Here is the syntax of the IMCSC function:

=IMCSC(inumber)
  • inumber – The complex number you want the cosecant of.

The argument takes a complex number written as text, like “2-i” or “0.8+1.5j”, or a cell that holds one. When you type a complex number straight into the formula, put it in double quotes, so =IMCSC("2-i") returns 0.6354937992539-0.221500930850509i.

The letter at the end marks the imaginary part. You can use i or j (j is how electrical engineers write it), and IMCSC keeps whichever letter you used in its result.

You can also give it a plain number. IMCSC treats it as a complex number with no imaginary part, so =IMCSC(1.5) returns 1.00251130424672.

The IMCSC function works in Excel 2013 and later versions, including Excel for Microsoft 365, Excel 2021, 2019, 2016, and Excel for Mac.

When to Use the IMCSC Function

Use this function when you need to:

  • Find the cosecant of complex numbers in a math or engineering worksheet
  • Check your answers for complex trigonometry homework
  • Work with complex numbers written in j notation, the way electrical engineers write them
  • Get the cosecant of a whole list of complex numbers with one formula

Let me show you a few practical examples of how to use the IMCSC function.

Example 1: Find the Cosecant of a Complex Number in Excel

Let’s start with a simple example.

Below is a practice set with a complex number in each row, and I want to find the cosecant of each one in column C.

Practice set with a complex number in each row and an empty Cosecant column

Here is the formula to enter in cell C2 and copy down:

=IMCSC(B2)
IMCSC formula in C2 copied down returns the cosecant of each complex number

IMCSC takes the complex number in B2 and returns its cosecant. So for 1+0.5i, you get 0.968610889043279-0.287408174140754i.

The result is text in the same x+yi form, with up to 15 significant digits in each part. When a part of the result is 0, Excel leaves it out, which is why problem 7 (2.5i) returns only an imaginary part, -0.165283669855096i.

Problem 9 holds the plain number 1.5, which is why it sits on the right side of its cell while the complex numbers sit on the left. IMCSC treats it as 1.5 with no imaginary part and returns 1.00251130424672.

Since the cosecant is 1 divided by the sine, you could also get it with IMDIV(1,IMSIN(B2)). IMCSC does the same job in one step, and the two can differ only in the 15th digit.

I’ve kept this first example as a per-row formula so you can see how IMCSC works on one number at a time. The next example handles the whole column with one formula.

Example 2: Get the Cosecant for a Whole Column with One Formula

In Excel 365 (and Excel 2021 or later), you can get the cosecant of a whole column with a single formula, but IMCSC needs one small trick to do it.

Below is a list of complex numbers written in j notation, and I want to get the cosecant of each one in column C.

Complex numbers in j notation with an empty Cosecant column and an empty Result cell in F2

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

=IMCSC(B2:B11)
IMCSC with a plain range in F2 returns the #VALUE! error

This happens because IMCSC can’t take a multi-cell range reference like B2:B11. It only works with single values, 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 IMCSC the values as an array. Here is the formula that works:

=IMCSC(+B2:B11)
IMCSC with a plus sign before the range in C2 spills the cosecant of every value

Enter this in cell C2, and it spills the results down to C11. IMCSC also keeps the j in its results, so 0.8+1.5j returns 0.334265328441664-0.293850377126272j.

Important: Use just the plus sign here. Adding +0 or a double minus (–) to the range 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:

=IMCSC(B2)

Example 3: Use Separate Real and Imaginary Part Columns

Sometimes your complex numbers aren’t written as text at all. Instead, the real part sits in one column and the imaginary part in another.

Below is a table with the real part of each complex number in column A and the imaginary part in column B, and I want to get the cosecant of each complex number in column C.

Real and imaginary parts in separate columns with empty cosecant columns

Here is the formula to enter in cell C2:

=IMCSC(COMPLEX(+A2:A11,+B2:B11))
IMCSC with COMPLEX in C2 spills the cosecant built from the two part columns

The COMPLEX function joins each pair of parts into a complex number, so 0.7 and 1.2 become 0.7+1.2i, and IMCSC then returns its cosecant. The result spills down to C11.

Both ranges need the plus sign because COMPLEX has the same range limitation as IMCSC. COMPLEX hands its results to IMCSC as an array, so IMCSC doesn’t need a plus sign of its own.

The results in column C are text, so you can’t round them or use them in a chart directly. To get the real and imaginary parts of each cosecant as regular numbers, enter this formula in cell D2:

=HSTACK(ROUND(IMREAL(+C2#),4),ROUND(IMAGINARY(+C2#),4))
HSTACK formula in D2 splits each cosecant into rounded real and imaginary numbers

How this formula works:

  • The IMREAL and IMAGINARY functions pull the real and imaginary parts out of each cosecant as numbers.
  • +C2# refers to the whole spilled result in column C. IMREAL and IMAGINARY have the same range limitation as IMCSC, so C2# needs the plus sign before they can use it.
  • ROUND(…,4) rounds each part to four decimal places.
  • The HSTACK function puts the two results side by side, so one formula fills both columns D and E.

So the first row’s cosecant, 0.43306503337857-0.428625953516574i, becomes 0.4331 in column D and -0.4286 in column E. Row 9 (real part 0) gives a real part of 0.0000, because its cosecant, -0.420951965887929i, has no real part.

HSTACK is available only in Excel 365 and Excel 2024, so here’s how to do the same thing in older versions.

If you are using Excel 2019 or earlier, start with the cosecant itself. Enter the below formula in cell C2 and then copy it down the range:

=IMCSC(COMPLEX(A2,B2))

Then, in any version without HSTACK (including Excel 2021, where the column C formula above still spills), enter the below formula in cell D2 and copy it down the range:

=ROUND(IMREAL(C2),4)

And enter this formula in cell E2 and copy it down the range:

=ROUND(IMAGINARY(C2),4)

Example 4: Fix #NUM! Errors in IMCSC Results

When complex numbers are typed in by hand, a few small slips can make IMCSC return the #NUM! error.

Below is a list of typed complex numbers with some uppercase I and J slips, two blank cells, and one genuine 0, and I want to get the cosecant of each one in column C.

Typed complex numbers with uppercase I and J, blank cells and a 0

Here is the formula to enter in cell C2:

=IMCSC(+B2:B11)
IMCSC on the typed values in C2 returns #NUM! for seven of the ten rows

Only three of the ten rows work. The other seven return #NUM!, for two different reasons.

IMCSC only recognizes a lowercase i or j. So 1.5+2I and 0.8+0.8J aren’t read as complex numbers at all, and IMCSC returns #NUM!.

The blank cells count as 0, and entry 5 is 0 too. The cosecant of 0 doesn’t exist, because the sine of 0 is 0 and you can’t divide by 0, so IMCSC returns #NUM! for these as well.

Here is a formula that fixes the letter case and leaves blank rows empty. Enter it in cell D2:

=IF(B2:B11="","",IMCSC(LOWER(B2:B11)))
IF and LOWER formula in D2 fixes the uppercase letters and leaves blank rows empty

The LOWER function changes I and J to i and j, so entries like 1.5+2I now work. LOWER returns an array, so the range doesn’t need a plus sign here.

The IF function checks for blank cells and returns an empty string for them instead of an error. Entry 5 still shows #NUM!, and that’s correct, because its cosecant doesn’t exist.

I’ve used IF instead of the IFERROR function on purpose. IFERROR would also hide the #NUM! for entry 5, and that error isn’t a typing slip, it’s the correct answer for 0.

If you are using Excel 2019 or earlier, enter the below formula in cell D2 and then copy it down the range:

=IF(B2="","",IMCSC(LOWER(B2)))

Example 5: IMCSC vs CSC for Regular Angles

Since IMCSC accepts plain numbers, you can use it on regular angles too. But Excel has the CSC function for that, and this example shows why it’s the better choice.

Below is a list of angles in degrees, and I want to get the cosecant of each angle with IMCSC in column B and with CSC in column C.

Angles in degrees with empty IMCSC Result and CSC Result columns

Here is the IMCSC formula to enter in cell B2:

=IMCSC(RADIANS(A2:A11))
IMCSC with RADIANS in B2 returns the cosecant of each angle as text

The RADIANS function converts each angle from degrees to radians, which is what IMCSC expects. RADIANS returns an array, so IMCSC spills without a plus sign.

The values are right (30 degrees gives 2, and 90 degrees gives 1), but they’re all text, which is why they sit on the left side of the cells. Because they’re text, number formatting won’t apply to them, and the SUM function skips them.

Here is the CSC formula to enter in cell C2:

=CSC(RADIANS(A2:A11))
CSC with RADIANS in C2 returns the cosecant of each angle as numbers

CSC returns real numbers, so you can format them, round them, and total them like any other numbers.

At 0 degrees, IMCSC returns #NUM! while CSC returns #DIV/0!. Both are telling you the same thing, that the cosecant of 0 doesn’t exist.

At 180 degrees, IMCSC shows 8162276138809540 instead of an error, and CSC returns the same huge number (column C shows it as 8.16228E+15).

That’s because Excel can’t store pi exactly, so the sine of 180 degrees comes out as a tiny number very close to 0 instead of exactly 0.

So for regular angles, use CSC. Keep IMCSC for numbers that have an imaginary part.

If you are using Excel 2019 or earlier, enter the below formula in cell B2 and then copy it down the range:

=IMCSC(RADIANS(A2))

And for the CSC column, enter the below formula in cell C2 and then copy it down the range:

=CSC(RADIANS(A2))

So these are some practical ways to use the IMCSC function in Excel to get the cosecant of complex numbers.

Just remember to put a plus sign in front of your ranges when you want one formula for a whole column, and keep the i or j lowercase. I hope you found this article helpful.

List of All Excel Functions

Other Excel Articles You May Also Like:

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.