Naming ranges of cells based on type

kcin

Board Regular
Joined
Jun 6, 2006
Messages
118
Hello,

I am trying to create named lists of ranges of cells and I really have no idea how. Basically my worksheet is setup like this:

Product Price

Apple $0.50
Banana $0.25
BMW $30,000
Chevrolet $10,000
Orange $1.00
Volkswagon $20,000

Now I will be graphing this data as a bar chart and sort it in ascending or descending order. What I would like to do is "Categorize" each product into its own "group" and then be easily able to calculate the average price for each "group". Is there a way to select the cells "Apple" and "$0.50" and categorize them as "Fruit"? Then once I categorize all the "Fruit" I can use a simple formula such as =Average(Fruit) and it will give me the average price just for the fruit items?

Any help with this would be greatly appreciated, thanks.
 

Some videos you may like

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Anthony47

Well-known Member
Joined
Mar 29, 2006
Messages
1,970
Try using a new colomn (say C) to define, item by item, the Category; then you can either set an Autofilter on column C and use =SUBTOTAL(1,C2:C1000) to display the average price of the filtered items; or use a pivot table with Category in the Row area and "Average of price" in the Data area, and you will get a table with all the average prices; you will not see "Average of price" while setting the layout of the pivot table but, probably, "Count of.." or "Sum of..": just double click what you see and choose "Average" in the list that will be shown.

If you need assistance about creating the pivot table, just ask.

Bye.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
47,926
Office Version
  1. 365
Platform
  1. Windows
Yet another option, after adding the extra column, is to use an array formula (confirmed with Ctrl+Shift+Enter, not just Enter) as follows.

Excel Workbook
ABCDEF
1ProductPriceCategoryCategoryAverage
2Apple0.5FruitCar20,000.00
3Banana0.25FruitFruit0.58
4BMW30,000Car
5Chevrolet10,000Car
6Orange1Fruit
7Volkswagon20,000Car
Average by Category
 

Watch MrExcel Video

Forum statistics

Threads
1,122,372
Messages
5,595,787
Members
414,021
Latest member
whyjaydee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top