TANH returns the hyperbolic tangent of a number, which is a value between -1 and 1 that approaches those limits as the input grows. It is useful for modelling saturation, smoothing data, and creating S-shaped curves.
=TANH(number)What does TANH do?
The TANH function calculates the hyperbolic tangent of a given number. In simple terms, it takes any real number and returns a value between -1 and 1. For small inputs, the result is close to the input itself; as the input gets larger (positive or negative), the result gets closer to 1 or -1 but never reaches it. This makes TANH a natural way to model situations where growth slows down and levels off.
You might wonder why you would need this in an office setting. TANH is handy whenever you want to compress a wide range of values into a fixed scale, create a smooth transition between two states, or simulate diminishing returns. For example, in sales forecasting, you might use TANH to represent how additional marketing spend has a decreasing effect as the market becomes saturated. In finance, it can help model the price sensitivity of options or the gradual impact of interest rate changes.
A real situation where TANH helps: suppose you are analysing website traffic and want to convert raw visit counts into a score between -1 and 1 to compare performance across different regions. Using TANH, you can easily create such a score without complex formulas. The function is straightforward to use and integrates seamlessly with other Excel functions.
When to use TANH
- Modelling saturation effects in marketing or sales response curves
- Normalising data to a -1 to 1 scale for comparison
- Creating smooth S-shaped curves for forecasting
- Simulating diminishing returns in financial models
- Converting raw scores into bounded values for dashboards
- Teaching or learning about hyperbolic functions in mathematics
TANH syntax
=TANH(number)| Argument | Required? | What to enter |
|---|---|---|
number | Required | The real number for which you want the hyperbolic tangent. It can be a cell reference, a formula, or a hard-coded value. For example, =TANH(1) returns approximately 0.7616. |
What it returns: The hyperbolic tangent of the number, a value between -1 and 1.
TANH examples
1 Basic TANH calculation
This example shows the simplest use of TANH. The goal is to calculate the hyperbolic tangent of a single number. The formula =TANH(B2) takes the value in cell B2 (which is 1) and returns approximately 0.7616. This demonstrates how TANH transforms a positive number into a value less than 1.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Input | Value | |||
| 2 | x | 1 | 0.761594156 | ||
| 3 |
2 TANH with negative input
Here we apply TANH to a negative number to see the symmetry. The formula =TANH(B2) uses the value -2 in B2. TANH is an odd function, so the result is the negative of TANH(2). The expected result is approximately -0.9640, showing that negative inputs yield negative outputs close to -1.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Input | Value | |||
| 2 | x | -2 | -0.9640275801 | ||
| 3 |
3 TANH for normalising sales data
Suppose you have monthly sales figures and want to convert them to a -1 to 1 scale for comparison. The formula =TANH(B2/1000) divides the sales amount in B2 by 1000 to scale it down, then applies TANH. For a sale of 1200, B2/1000 = 1.2, and TANH(1.2) ≈ 0.8337. This gives a normalised score that reflects the relative size of the sale.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Month | Sales | |||
| 2 | Jan | 1200 | 0.833654607 | ||
| 3 | Feb | 800 | |||
| 4 | Mar | 1500 | |||
| 5 |
4 TANH with a date difference
This example calculates the number of days between two dates and then applies TANH. The formula =TANH(B2-A2) subtracts the start date in A2 from the end date in B2, giving the number of days (10). TANH(10) is very close to 1, approximately 0.999999996. This shows how TANH compresses larger values toward 1.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Start Date | End Date | |||
| 2 | 2023-01-01 | 2023-01-11 | 0.9999999959 | ||
| 3 |
5 TANH for modelling diminishing returns
In this business scenario, we model how additional advertising spend affects sales lift. The formula =TANH(B2/10000) takes the ad spend in B2, divides by 10000 to scale, and applies TANH. For a spend of 5000, B2/10000 = 0.5, and TANH(0.5) ≈ 0.4621. This represents a sales lift factor that increases with spend but at a decreasing rate, approaching 1 as spend grows.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Campaign | Ad Spend | |||
| 2 | Spring | 5000 | 0.4621171573 | ||
| 3 | Summer | 15000 | |||
| 4 | Fall | 25000 | |||
| 5 |
Common TANH errors and how to fix them
| Error | Why it happens | How to fix it |
|---|---|---|
| #VALUE! | The argument is non-numeric, such as text that cannot be converted to a number. | Ensure the argument is a number or a reference to a cell containing a number. Use VALUE or check for text. |
| #NAME? | The function name is misspelled, e.g., TANHH or TANH not recognised. | Check the spelling: it should be TANH. |
| #REF! | The cell reference in the argument is invalid, often due to deleted cells. | Verify that the referenced cells exist and adjust the formula accordingly. |
Tips for using TANH
- TANH is often used to create smooth transitions; combine it with scaling factors to control the steepness.
- Remember that TANH never returns exactly 1 or -1; for very large inputs, it returns values extremely close to those limits.
- Use TANH to bound values between -1 and 1 without hard limits, which is useful in scoring models.
- When working with dates, Excel stores them as serial numbers, so TANH can be applied to date differences directly.
- For financial modelling, TANH can represent the gradual impact of a variable, such as interest rate changes on bond prices.
Frequently asked questions
What is the difference between TANH and TAN?
TANH calculates the hyperbolic tangent, while TAN calculates the regular trigonometric tangent. TANH returns values between -1 and 1, whereas TAN can return any real number.
Can TANH handle very large numbers?
Yes, TANH approaches 1 for large positive numbers and -1 for large negative numbers. For example, TANH(1000) returns 1 (due to floating-point precision).
How do I use TANH with degrees?
TANH does not use degrees; it operates on real numbers. If you have an angle in degrees, convert it to radians first using RADIANS, but note that TANH is not the same as the tangent of an angle.
Is TANH available in all Excel versions?
Yes, TANH is available in all versions of Excel, including Excel for Microsoft 365, Excel 2019, 2016, and earlier.
What does TANH(0) return?
TANH(0) returns 0, because the hyperbolic tangent of 0 is 0.
Related functions
Every example on this page was recalculated by SheetSkill’s spreadsheet engine. TANH reference