?
Solved

Using EXCEL to count the number of Rows

Posted on 2016-11-11
4
Medium Priority
?
104 Views
Last Modified: 2016-11-18
Hi all - How do I use Excel to give me the number of rows containing a certain item, for all rows?
See 2 tiny examples attached ... that should explain everything!  I want excel to tell me how many Cars, how many Boats, and how many Trucks I have.  The file is already sorted on that field, and formatting and location of the result is not important ... I just need the numbers. (The actual spreadsheets have 20,000+ records in them)
What-I-want.xlsx
What-I-have.xlsx
0
Comment
Question by:bleggee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 34

Assisted Solution

by:Norie
Norie earned 500 total points
ID: 41884202
Try putting this formula in C1 and copying it down.

=IF(A1=A2,"",COUNTIF($A$1:$A$10,A1))
0
 
LVL 33

Assisted Solution

by:Rob Henson
Rob Henson earned 500 total points
ID: 41886002
Putting the formula in column C assumes that the data in column A is sorted in order so that all vehicles of a type are together.

Another great way of doing this would be to use a Pivot Table. This could also summarise the numerical data in column B if you wanted.

See attached.
What-I-have.xlsx
0
 
LVL 8

Accepted Solution

by:
Mike in IT earned 1000 total points
ID: 41887836
You could make the column with the "car, boat, truck" a named column then use a formula like:
=CONCATENATE("There are ",COUNTIF(vehicle,A1)," ",A1,"s")

Open in new window


This would give you a result of:
"There are 2 cars" in each row that has cars
"There are 3 boats" in each row that has boats
"There are 5 trucks" in each row that has trucks

Then you could just remove duplicates and you would be left with just the three statements.

OR

You could use formulas like these, still with the named column:
=CONCATENATE("There are ",COUNTIF(vehicle,"car")," cars")

Open in new window

=CONCATENATE("There are ",COUNTIF(vehicle,"boat")," boats")

Open in new window

=CONCATENATE("There are ",COUNTIF(vehicle,"truck")," trucks")

Open in new window

Put those in the top three cells and you'll have the counts that you want and know what the counts are for.

Here's your file with both ways included.

What-I-have---updated.xlsx

In case you don't know how to name a column there are two ways.
1. highlight the column
    a. right click
    b. select "Define Name"
    c. type a name, something that is easily remembered and distinct
    d. click "OK"
    e. you now have a named area that you can use in formulas

2. select the formulas tab
    a. in the "Defined Names" section select the "Name Manager"
    b. click "New"
    c. in the box that comes up type name
    d. click the "Refers to:" selector
    e. select the area you want named
    f. click "OK"
    g. you now have a named area that you can use in formulas
0
 
LVL 1

Author Comment

by:bleggee
ID: 41893893
thx
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question