IMSEC function
Returns the secant of a complex number, 1/cos(z).
Available in Excel 2013 and later, Microsoft 365, Excel for the web, Excel for Mac 2016 and later
Excel 2013 and laterWorks in Google Sheets
Syntax
IMSEC(inumber)| Argument | What it means | |
|---|---|---|
inumber | Required | A complex number as text such as "3+4i" or "5-2j", a cell containing one, or a plain number. Build it with COMPLEX to avoid typing errors. |
Returns: A complex number as text.
How IMSEC works
IMSEC returns the secant of a complex number, the reciprocal of IMCOS: sec z = 1 / cos z. Like all IM functions, it reads complex numbers written as text (x+yi or x+yj) and returns its answer as text with up to 15 significant digits, so you can feed the result straight into another IM function.
Complex trigonometric and hyperbolic functions are mostly used in electrical engineering (transmission lines, filters), control theory and physics. For everyday spreadsheets you will rarely need them, but they make it possible to keep a whole calculation in Excel instead of switching to a maths package.
Examples
1Evaluate at the imaginary unit i
| A | B | |
|---|---|---|
| 1 | Complex number | |
| 2 | i | 0.648054273663885 |
Result: 0.648054273663885
sec(i) = 1/cosh(1) ≈ 0.6481, a real number.
2Secant of a real angle
| A | |
|---|---|
| 1 | 2 |
Result: 2
sec(60°) = 1/cos(60°) = 1/0.5 = 2. The tiny floating-point error in π/3 is rounded away by the 15-digit display, so the result is 2.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | The text is not a valid complex number — for example it contains spaces (3 + 4i), a capital I, or a misplaced sign. | Create the value with COMPLEX or remove spaces with SUBSTITUTE. |
#VALUE! | The argument is a logical value, or the formula mixes the i and j suffixes. | Use one suffix consistently throughout a calculation. |
Tips
Google Sheets
IMSEC also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
IMSEC in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | IMAGSEC |
| Dutch | C.SEC |
| Finnish | KOMPLEKSI.SEK |
| French | COMPLEXE.SEC |
| Hungarian | KÉPZ.SEC |
| Italian | COMP.SEC |
| Polish | SEC.LICZBY.ZESP |
| Russian | МНИМ.SEC |
| Spanish | IM.SEC |
| Swedish | IMSEK |
| Turkish | SANSEC |