• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Excel Tutorials by Y. Acosta

Excel Tutorials + Tips

  • Excel Tutorials
  • Etsy Store
  • Other Resources
  • About Me
    • About Me
    • Contact Me
    • FREE Printable List of Top Excel Keyboard Shortcuts
  • FREE pdf of Top Excel Shortcuts!

Count How Many Cells are Referenced in a Formula in Excel

❤ Support Free Excel Training by Sharing -

We may be compensated for your purchase of any of the products featured on this page – it helps us keep the lights on :)

A viewer reached out wanting to know how he can count how many cells are referenced in a formula in Excel. Was this even possible???

For example, say he has a formula like AVERAGE(A1,A2,A3) in cell A4. What formula could he use to let him know that 3 cells were referenced?

I thought about this for a while and realized that, as long as each cell in the formula is listed individually, it’s possible to calculate the number of cells referenced by looking at how many commas were used.

Count the Number of Cells Used in an Excel Formula

Excel spreadsheets can quickly become overwhelming. Especially if you have to make changes to formulas. Deciphering which cells are used in a formula can get confusing fast!

Here’s the formula I recommended for counting the number of cells in the formula:

=LEN(FORMULATEXT(A4))-LEN(SUBSTITUTE(FORMULATEXT(A4),”,”,””))+1

It looks overwhelming, I know! But it’s really not. It combines three Excel formulas to, essentially, calculate:

(Total Number of Characters – Total Number of Characters Without Commas)+1 

Here’s how it works:

  • =LEN(FORMULATEXT(A4))-LEN(SUBSTITUTE(FORMULATEXT(A4),”,”,””))+1:
    • The formula uses a combination of the LEN function (counts number of characters) and the FORMULATEXT function (converts cell contents to text) to count the number of text characters in the formula that you’re trying to audit.
      • Essentially, answering the question: if the formula was all text, how many characters does it have?
  • =LEN(FORMULATEXT(A4))-LEN(SUBSTITUTE(FORMULATEXT(A4),”,”,””))+1:
    • It then uses the SUBSTITUTE function (like the Find & Replace feature, but in a function) to replace all the commas in the cell with nothing (not even a space).
  • =LEN(FORMULATEXT(A4))-LEN(SUBSTITUTE(FORMULATEXT(A4),”,”,””))+1:
    • Next, it uses the LEN function again to count the number of characters in the new text (without the commas) and subtracts this from the original count of characters.
  • =LEN(FORMULATEXT(A4))-LEN(SUBSTITUTE(FORMULATEXT(A4),”,”,””))+1:
    • Lastly, add 1 at the end to make up for the first cell reference (that never has a comma in front of it).

Want to try it for yourself? You can use this spreadsheet to experiment with the formula.

FYI, this was created using the desktop version of Excel in Microsoft 365.


How Many Cells are Used in an Excel Formula (Pin for Pinterest)

Related Articles:

  • Apply Multiple Data Validation Rules in Excel (feat. image, thumbnail)
    3 Steps - Apply Multiple Data Validation…
  • Change a Range of Cells from Negative to Positive in Excel (thumbnail image)
    4 Ways: Change Negative Numbers to…
  • Make a Word Jumble in Excel / Make a Word Scramble in Excel - Tutorial
    Make a Word Jumble in Excel (+ video tutorial)

❤ Support Free Excel Training by Sharing -

blank

About Y. Acosta

Yil's (pronounced like "Jill") passion for Excel spreadsheets can be traced back to her days in marketing, where she spent significant time working on analytics. As a content creator, she now specializes in Excel spreadsheet tutorials. Make sure to visit the About page to learn more.

Reader Interactions

Comments

  1. blankpaul says

    at

    if you get an error, rewrite the quotation marks in the equation manually.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow us:

Latest Tutorial:

Featured image for How to Use Find & Replace to Remove Wildcard Characters in Excel article

Click Here for More Excel Tutorials!!!

Get Your FREE pdf of Top Excel Keyboard Shortcuts!

* indicates required

blank

Image-button for Invoice Template for Etsy

Copyright © 2025

  • Home
  • Excel Tutorials
  • Resources
  • About Me
  • Privacy Policy & Terms of Use
  • Disclaimer
  • Advertiser Disclosure
  • Contact Me
  • FREE Printable List of Top Excel Keyboard Shortcuts
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
SettingsAccept
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT