We help IT Professionals succeed at work.

# How to count rows in excel

on
142 Views
Hi guys,

I have an excel file with a column(R) named city, I need a formula to count how many rows there are for each city, so the result must be like this:

But I don't want to use any criteria

Los Angeles     10
Burbank             5
Van Nuys         11

And so on.....

Comment
Watch Question

## View Solutions Only

Senior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019

Commented:
``````=COUNTIF(R:R;A1)
``````
Top Expert 2016

Commented:
=countif(range,"criteria")
Managing Director/Excel VBA Developer
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
You can use below formula for each city, Assuming you have City Name in cell cell A1
``````=COUNTIF(R:R, A1)
``````
Top Expert 2016

Commented:
I should have read more carefully. ;)
Senior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019

Commented:
Was still editing :). Always forget to change ; to ,
Paste this in B1 and copy down. This assumes data (Los Angeles) starts at A1
``````=COUNTIF(R:R,A1)
``````
Excel & VBA Expert
CERTIFIED EXPERT
Most Valuable Expert 2018
Awarded 2015
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)

Commented:
Well, the idea is to make a graph that automatically is updating while more records are adding.
Senior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
Managing Director/Excel VBA Developer
CERTIFIED EXPERT
Distinguished Expert 2018
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
Top Expert 2016
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
Excel & VBA Expert
CERTIFIED EXPERT
Most Valuable Expert 2018
Awarded 2015

Commented:
Well, the idea is to make a graph that automatically is updating while more records are adding.
In that case convert you data range into an Excel Table so the source data for a graph or the pivot table will automatically be updated.
Top Expert 2016

Commented:
use an offset formula for the name range

=offset(\$a\$1,0,0,counta(\$a:\$a),10)  <--- here you put the number of columns of your sheet 10 is just an example

Commented:
Guys, I'm sorry for the delay, I was working in an other things but finally, I used the pivot option as subodh suggested and it is working good.

Thank you guys.

:)

Commented:
Great job!!!
Excel & VBA Expert
CERTIFIED EXPERT
Most Valuable Expert 2018
Awarded 2015

Commented:
You're welcome. Glad we could help.
Senior Consultant
CERTIFIED EXPERT
Awarded 2017
Distinguished Expert 2019

Commented:
Please remember to endorse my, or any other expert's comments that you found helpful by clicking on the "Thumb's Up" button

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

###### Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

Deciding to stick with EE.

Mohamed Asif

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
###### Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Connect with Certified Experts to gain insight and support on specific technology challenges including:

• Troubleshooting
• Research
• Professional Opinions
Unlock the solution to this question.