Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to average values based on text in another column in Excel?

Author Xiaoyang Last modified

If you have a dataset where one column contains categories or items and another column contains numerical values, and you want to calculate the average for the numerical values based on specific items in the first column, this guide will help you. For example, if column A contains product names and column B contains total prices, you can calculate the average price for each product as shown in the screenshot below. And this guide will show you two methods: using formulas and using Kutools for Excel.

Average values based on text in another column with formulas

Average values based on text in another column with Kutools for Excel

A screenshot displaying a table of product names, total prices, and the calculated average values based on specific product names in Excel


Average values based on text in another column with formulas

To calculate the average based on another column's data, the following formulas may do you a favor, please do as follows:

1. First, you should extract the unique values from column A, please apply this array formula: =IFERROR(INDEX($A$2:$A$17, MATCH(0,COUNTIF($E$1:E1, $A$2:$A$17), 0)),"") into a blank cell, E2 for example, then press Ctrl + Shift + Enter keys together to get to correct result, see screenshot:

A screenshot of extracting unique values in Excel using a formula

Note: In the above formula, A2:A17 is the list that you want to extract unique values from, E1 is the first cell of the column you want to put out the extracting result.

2. Then drag the fill handle down to extract all unique values until blank cell is displayed, see screenshot:

A screenshot showing unique values extracted in Excel

3. After extracting the unique values from column A, and now, you should use this formula: =AVERAGEIF($A$2:$A$17,E2,$B$2:$B$17) into cell F2 to calculate the average of the product “Apple”, then drag the fill handle down to the cells that you want to apply this formula, and the average of the values based on a specific text has been calculated at once, see screenshot:

A screenshot of calculating the average of values based on specific text in Excel

Note: In this formula: A2:A17 is the original data which contains the specific text you want to average based on, E2 is the unique value you have extracted, and B2:B17 is the total price column that you want to calculate the average.


Average values based on text in another column with Kutools for Excel

If you have Kutools for Excel, with its Advanced Combine Rows utility, you can quickly combine, sum, average the corresponding values from one column based on another column's data.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After installing Kutools for Excel, please do as follows:( Free Download Kutools for Excel Now! )

1. Select the data range that you want to use.

2. Click Kutools > Merge & Split > Advanced Combine Rows, see screenshot:

A screenshot of the Advanced Combine Rows option in Kutools tab on the ribbon

3. In the Advanced Combine Rows dialog box, click the column which contains the certain value you want to average based on, and then click Primary Key to set it as primary key, see screenshot:

A screenshot of setting a column as the primary key in the Advanced Combine Rows dialog box

Tips: If your selection includes headers, please check My data has headers option.

4. Go on clicking another column that you want to calculate the average, and then click Calculate > Average, see screenshot:

A screenshot of setting the average calculation

5. After finishing the settings, please click Ok button, and the average of the total price has been calculated based on the same data in column A, see screenshot:

A screenshot showing the final calculated average

Kutools for Excel - Supercharge Excel with over 300 essential tools. Enjoy permanently free AI features! Get It Now


Demo: Average values if another column contains certain text with Kutools for Excel

 
Kutools for Excel: Over 300 handy tools at your fingertips! Enjoy permanently free AI features! Download Now!

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

Excel Word Outlook Tabs PowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in