Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Google Sheets TANH Function: Step-by-Step Guide

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

The TANH function in Google Sheets returns the hyperbolic tangent of a given number. It is the spreadsheet equivalent of the mathematical tanh(x) = (e^x - e^-x) / (e^x + e^-x), and it accepts any real number, positive or negative. You do not need to install anything or enable a special add-on; TANH is a built-in function available in every Google Sheets spreadsheet. The steps below show how to enter it correctly, how to apply it to a whole column of data, and how to avoid the errors that most often trip people up.

What You'll Need

  • A Google account with access to Google Sheets (the free version is fine).
  • A spreadsheet open in a browser or the Google Sheets mobile app.
  • At least one numeric value or a cell reference containing a number to pass to the function.

Step-by-Step

  1. Open your spreadsheet. Go to sheets.google.com, sign in, and open an existing file or create a new blank spreadsheet. The steps below work the same on desktop and in the mobile app, though the formula bar looks slightly different on a phone.
  2. Select the cell where you want the result. Click or tap an empty cell. This is where the hyperbolic tangent value will appear.
  3. Type the formula. Start with an equals sign, then the function name, then an opening parenthesis. For example: =TANH(. Google Sheets will show a small hint box with the expected syntax as you type.
  4. Enter the argument. You can type a number directly, such as =TANH(1), or reference another cell, such as =TANH(A2). The argument must be a single numeric value or a reference to a cell containing a number. Do not put text inside the parentheses unless it is a cell reference that resolves to a number.
  5. Close the parenthesis and press Enter. The cell will display the result. For example, =TANH(1) returns approximately 0.7616. Negative inputs return negative results, and TANH(0) returns 0.
  6. Copy the formula down a column (optional). If you have a list of numbers in column A and want the hyperbolic tangent of each one, put =TANH(A2) in B2, then drag the fill handle (the small square at the bottom-right of the cell) down to fill the rest of the column. On mobile, you can copy the cell and paste it into the cells below, or use the fill handle if your version of the app supports it.
  7. Format the result if needed. The output is a decimal number. If you want a fixed number of decimal places, select the cells and use the decimal place buttons in the toolbar, or go to Format > Number > Number and set the decimal places. This does not change the underlying value, only how it is displayed.

Common Mistakes

  • Forgetting the equals sign. Typing TANH(1) without a leading = makes Sheets treat it as text, not a formula. The cell will show the literal string instead of a result.
  • Using a comma or semicolon inside the parentheses. TANH takes exactly one argument. Adding a second argument, such as =TANH(1, 2), produces an error. If your locale uses a different argument separator, that only matters for functions with multiple arguments; TANH still takes one.
  • Passing text instead of a number. If the referenced cell contains text like "1.5 kg" or an empty string, TANH returns a #VALUE! error. Make sure the source cell holds a plain number.
  • Confusing TANH with TAN. TAN returns the tangent (a trigonometric function), while TANH returns the hyperbolic tangent. They are different functions and produce different results. Use TANH when you specifically need the hyperbolic version.
  • Expecting degrees or radians. TANH does not use angles or angle units. It takes a real number and returns a value between -1 and 1. There is no need to convert degrees to radians as you would with SIN, COS, or TAN.
  • Dragging a formula without locking the reference. If you copy =TANH(A2) down, the reference changes to A3, A4, and so on, which is usually what you want. But if you copy across columns and need to keep the same source column, use =TANH($A2) to lock the column.

Tips

  • Use TANH for squashing values between -1 and 1. It is handy when you want to compress a range of numbers into a bounded interval without hard clipping. For example, large positive inputs approach 1, large negative inputs approach -1, and small inputs stay close to their original value.
  • Combine with ARRAYFORMULA for whole columns. Instead of dragging, you can put =ARRAYFORMULA(TANH(A2:A100)) in a single cell to fill the entire range at once. This is faster for long lists and keeps the formula in one place.
  • Check for errors with ISNUMBER. If your source data might contain text, wrap the reference in a check, such as =IF(ISNUMBER(A2), TANH(A2), ""), to avoid #VALUE! errors and keep the sheet clean.
  • Remember the output range. TANH always returns a number between -1 and 1 (exclusive for finite inputs). If you see a result outside that range, something is wrong with the formula or the input.
  • Use the formula bar to inspect long formulas. On desktop, click a cell and look at the formula bar at the top to see exactly what was entered. On mobile, tap the cell and check the formula preview above the keyboard.

Troubleshooting

If TANH does not return the expected result, work through these checks in order:

  • #NAME? error: This usually means the function name is misspelled, such as TANHH or TAN H. Correct it to TANH. It can also appear if you are using a locale where the function name is translated, but TANH is the standard name in Google Sheets for English and most locales.
  • #VALUE! error: The argument is not a number. Check the referenced cell for hidden spaces, text, or an empty value. Use =ISNUMBER(A2) in a nearby cell to test whether the source is numeric.
  • #N/A error: This can happen if the referenced cell is part of a range that does not exist or if a formula inside the reference fails. Simplify the formula to a direct number, such as =TANH(1), to confirm the function itself works, then rebuild the reference.
  • Result looks like text: The cell may be formatted as plain text. Select the cell, go to Format > Number > Automatic or Number, and the formula should calculate. If the cell still shows the formula as text, make sure the first character is an equals sign and that there is no leading apostrophe.
  • Formula not updating: Check that iterative calculation is not interfering (File > Settings > Calculation). Usually the issue is that the sheet is in manual calculation mode. Set it back to automatic, or press Ctrl+R (Cmd+R on Mac) to recalculate.
  • Mobile app behaves differently: Some older versions of the Google Sheets mobile app have limited formula editing. If the formula will not enter, try updating the app from the official app store, or use the desktop browser version for complex formulas.

Frequently Asked Questions

What does the TANH function do in Google Sheets?

It returns the hyperbolic tangent of a number, which is a mathematical function that maps any real number to a value between -1 and 1. It is equivalent to (e^x - e^-x) / (e^x + e^-x).

Can TANH take more than one argument?

No. TANH accepts exactly one argument: a number or a reference to a cell containing a number. Adding a second argument causes an error.

Does TANH work with negative numbers?

Yes. TANH is an odd function, so TANH(-x) = -TANH(x). For example, TANH(-1) returns approximately -0.7616.

What is the difference between TAN and TANH?

TAN is the trigonometric tangent and uses angles (radians by default). TANH is the hyperbolic tangent and takes a plain real number. They are not interchangeable.

Can I use TANH on a whole range without dragging?

Yes, with ARRAYFORMULA. Enter =ARRAYFORMULA(TANH(A2:A100)) in one cell and it will spill results down the column. Make sure the output range is empty before you enter it.

Why does TANH return 1 or -1 for large numbers?

Because the hyperbolic tangent approaches 1 as the input grows large and -1 as it grows very negative. For inputs beyond about 20, the result rounds to exactly 1 in standard floating-point precision, which is expected behavior.