The IMSECH function in Excel gives you the hyperbolic secant of a complex number, which is 1 divided by its hyperbolic cosine. If you’re working through engineering or math problems with values like 4+3i, it saves you from doing that calculation by hand.
A couple of things about it can catch you off guard. The result comes back as text, so the ROUND function and number formats don’t work on it directly, and an empty cell quietly returns 1 instead of an error.
Below, I’ll go through six examples that cover both of these, plus how to run IMSECH on a whole column with one formula.
Follow along with the example file
IMSECH Function Examples.xlsx
IMSECH Function Syntax
Here is the syntax of the IMSECH function:
=IMSECH(inumber)
- inumber – The complex number you want the hyperbolic secant of.
The inumber argument takes a complex number written as text, like “4+3i” or “4+3j”, or a reference to a cell that holds one. If you type it straight into the formula, wrap it in double quotes, so =IMSECH("4+3i") returns -0.0362534969158689-0.00516434460775318i.
A regular number works too. IMSECH treats it as a complex number with no imaginary part, so =IMSECH(2) returns 0.26580222883408.
The IMSECH function works in Excel for Microsoft 365, Excel 2024, 2021, 2019, 2016, and Excel 2021 or later for Mac.
When to Use the IMSECH Function
Use this function when you need to:
- Find the hyperbolic secant of complex numbers in an engineering or math worksheet
- Check textbook or homework answers that involve the hyperbolic secant of a complex number
- Work through physics or engineering formulas where the hyperbolic secant of a complex value shows up
- Get the hyperbolic secant when the real and imaginary parts sit in separate columns
Let me show you a few practical examples of how to use the IMSECH function.
Example 1: Find the Hyperbolic Secant of Different Complex Numbers
Let’s start with a simple example.
Below is a list of complex numbers written in different ways, with a label for each type, and I want to get the hyperbolic secant of each one in column C.

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

IMSECH takes the complex number in B2 and returns its hyperbolic secant, so 4+3i gives -0.0362534969158689-0.00516434460775318i. The result is a complex number in text form, with a long run of decimals in each part.
The labels in column A help you spot a few patterns in the results:
- Negative of row 2 (row 3): -4-3i gives exactly the same result as 4+3i. Flipping the sign of the whole complex number doesn’t change its hyperbolic secant.
- Conjugate of row 2 (row 4): 4-3i flips only the sign of the imaginary part, and the imaginary part of the result flips sign too.
- Pure imaginary (rows 5 and 6): i and 2i have no real part, yet their results are plain numbers with no i. That’s because the hyperbolic secant of a pure imaginary number works out to 1 divided by the cosine of its imaginary part.
- Plain number (row 7): 2 gives a plain number too, 0.26580222883408.
- Uses j (row 8): 1+2j uses j instead of i, and IMSECH keeps the j in its result.
I’ve used a per-row formula here so each row reads as its own little test. In the next example, I’ll show you how to do a whole column with one formula.
Example 2: Use IMSECH on a Whole Column with One Formula
In Excel 365 and Excel 2021 or later, one formula can return the hyperbolic secant for an entire column. IMSECH just needs a small nudge to make it work.
Below is a quiz with ten complex number questions, and I want to build the answer key in column C.

Your first instinct might be to point IMSECH at the whole range. I’ve done that in cell F2, and it gives a #VALUE! error:
=IMSECH(B2:B11)

This happens because IMSECH doesn’t accept a multi-cell range reference like B2:B11. It only works with single values, or with an array (a list of values that Excel holds in memory).
Adding a plus sign (+) before the range fixes it, because Excel then passes the values to IMSECH as an array. Here is the formula that works:
=IMSECH(+B2:B11)

Enter it in cell C2, and the results spill down to C11. Q1 (1+1.5i) gives 0.0787483444732139-0.845722493389835i, and Q5 (3i) gives a plain number, -1.01010866590799.
Important: Stick to the plus sign here. Adding +0 or a double minus (–) also creates an array, but those try 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:
=IMSECH(B2)
Example 3: Calculate IMSECH from Separate Real and Imaginary Parts
Sometimes the real and imaginary parts sit in two separate columns, so you need to build the complex number first.
Below is a list with the real part of each complex number in column A and the imaginary part in column B, and I want the hyperbolic secant in column C.

Here is the formula to enter in cell C2:
=IMSECH(COMPLEX(+A2:A11,+B2:B11))

The COMPLEX function joins each real and imaginary part into one complex number, so 1.2 and 2 become 1.2+2i. IMSECH then returns the hyperbolic secant of each one, and the results spill down to C11.
The COMPLEX function doesn’t accept a multi-cell range either, so both ranges need the plus sign. Without it, the formula returns a #VALUE! error.
Rows 6 and 7 show what happens when one part is 0. A real part of 0 gives a plain number (14.1368329029699), and so does an imaginary part of 0 (0.772389673857264).
That 14.1368329029699 is large because 1.5 is close to pi/2, where the hyperbolic secant of a pure imaginary number shoots off toward infinity. Example 6 shows what happens right at that point.
If you want j in the results instead of i, add “j” as the third argument of the COMPLEX function, like =IMSECH(COMPLEX(+A2:A11,+B2:B11,"j")).
If you are using Excel 2019 or earlier, enter the below formula in cell C2 and then copy it down the range:
=IMSECH(COMPLEX(A2,B2))
Example 4: Round IMSECH Results to Fewer Decimals
IMSECH results come with a long string of decimals, which makes them hard to read and compare. Here’s how to round them.
Below is a list of complex numbers, and I want the hyperbolic secant in column B and a version rounded to four decimal places in column C.

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

This spills the full results down to B11. For 1+0.5i, you get 0.62948578135957-0.261904347488438i.
You can’t fix this with the ROUND function directly, because the result is text and the ROUND function returns a #VALUE! error. Instead, round the real and imaginary parts separately and put them back together.
Here is the formula to enter in cell C2:
=COMPLEX(ROUND(IMREAL(+B2#),4),ROUND(IMAGINARY(+B2#),4))

How this formula works:
- B2# refers to the whole spilled result in column B (B2:B11). It needs the plus sign too, because the IMREAL and IMAGINARY functions don’t accept a multi-cell range either.
- IMREAL(+B2#) and IMAGINARY(+B2#) pull out the real and imaginary parts of each result as regular numbers.
- ROUND(…,4) rounds each part to four decimal places.
- COMPLEX(…) joins the rounded parts back into a complex number.
Now 1+0.5i shows 0.6295-0.2619i. The COMPLEX function drops trailing zeros, which is why 1.4+1.4i shows 0.1-0.5134i and not 0.1000-0.5134i.
Pro Tip: If you only need the rounded results, you can skip column B and do it in one cell with the LET function: =LET(r,IMSECH(+A2:A11),COMPLEX(ROUND(IMREAL(r),4),ROUND(IMAGINARY(r),4))). 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:
=IMSECH(A2)
And for the rounded results, enter the below formula in cell C2 and then copy it down the range:
=COMPLEX(ROUND(IMREAL(B2),4),ROUND(IMAGINARY(B2),4))
Example 5: IMSECH vs SECH for Regular Numbers
IMSECH accepts regular numbers, so it’s tempting to use it for them too. But for numbers with no imaginary part, the SECH function is the better choice, and this example shows why.
Below is a list of regular numbers, and I want to compare the IMSECH result in column B with the SECH result in column C. Both result columns are already formatted to show four decimal places.

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

The values are correct, but they’re all text. They sit on the left side of the cells, and the four-decimal number format on column B is ignored, so 0.25 shows 0.969543629140215 instead of 0.9695.
And since the SUM function skips text, adding these results up gives you 0.
Here is the SECH formula to enter in cell C2:
=SECH(A2:A11)

The SECH function returns actual numbers, so the four-decimal format works, and you can total or chart them like any other numbers. It also accepts a range directly, so it spills without the plus-sign trick.
Notice that every result in column C is between 0 and 1, and a 0 gives exactly 1. Keep that in mind for the next example.
So use the SECH function for regular numbers, and keep IMSECH for values that have an imaginary part.
If you already have IMSECH results for regular numbers, like the ones in column B, the IMREAL function turns them into real numbers. For example, =IMREAL(+B2:B11) returns the same values as the SECH column.
If you are using Excel 2019 or earlier, enter the below formula in cell B2 and then copy it down the range:
=IMSECH(A2)
And for the SECH results, enter the below formula in cell C2 and then copy it down the range:
=SECH(A2)
Example 6: Why IMSECH Returns Errors or Odd Results
IMSECH is strict about how you write its input, and a couple of inputs give results that look fine but aren’t what you’d expect. This example puts them side by side.
Below is a list of inputs that cause errors or surprising results, and I want to see what IMSECH returns for each one in column C.

Here is the formula to enter in cell C2:
=IMSECH(+B2:B8)

Here’s what’s going on in each row:
- Uppercase I (4+3I): IMSECH only recognizes a lowercase i or j, so it returns the #NUM! error.
- Imaginary part first (3i+4): the real part has to come first, so this also returns #NUM!. Write it as 4+3i instead.
- Logical value (TRUE): IMSECH returns the #VALUE! error for TRUE or FALSE.
- Zero: the hyperbolic cosine of 0 is 1, so IMSECH returns 1. That’s the correct answer, not an error.
- Empty cell: Excel treats an empty cell as 0 here, so it also returns 1. A gap in your list shows up as a 1 with no warning.
- Pi/2 times i: the true answer doesn’t exist here, because the hyperbolic cosine is 0. But B7 holds
=COMPLEX(0,PI()/2), and PI() is accurate to about 15 digits, so Excel divides by a tiny number instead of 0 and gets -286413440886091. - Large real number (800): the true result is so small that Excel can’t store it, so IMSECH returns 0.
The empty cell and the pi/2 cases are the ones to watch, because neither of them gives you an error. The same huge-number result happens at other odd multiples of pi/2 times i, such as 3 pi/2 times i.
Important: If your list might have empty cells, a 1 in the results could be a blank input rather than a real answer. To keep those rows blank, use =IF(B2:B8="","",IMSECH(+B2:B8)) instead.
So these are some practical ways to use the IMSECH function in Excel to get the hyperbolic secant of complex numbers.
Just remember to put a plus sign in front of a range when you want one formula for a whole column, watch out for empty cells, and use the SECH function when your numbers have no imaginary part. I hope you found this article helpful.
Other Excel Articles You May Also Like: