Trouble with calculations in Excel table

Crumbs

New Member
Joined
Jul 30, 2013
Messages
3
Hey,


I have a table of number sof high-rise buildings in the US (attached here). What I'm trying to do (with formula or code) is to compute how many buildings there are (in all the US) with 14 floors. How many with 15 floors. Etc. with each number of floors. I am beginner-level with VBA. I started by sorting everything according to number of floors, then writing a For loop to go through the rows and start adding the numbers, but I ran into trouble that I didn't know how to handle (know when it's the first instance of that number of floors in order to start counting anew form there, etc.). You can see my code (very preliminary) in the file.


I need something like this (for all numbers of floors):


14 floors - 400 (buildings)
15 floors - 250
...




After that, I also need to do the same thing, but this time divided by States, meaning:


AK:
14 floors - 100
15 floors - 50
(for each state and for each number of floors)




I would be really glad for help with this issue.. too many little details that I'm not sure how to handle.
Thanks a lot!

Here's the file:

https://docs.google.com/file/d/0B-4vUrIGZBqoMktsN1VYSU5aSDg/edit?usp=sharing
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

vavs

Well-known Member
Joined
Jul 2, 2004
Messages
514
This seems like a pivot table issue. You can do a count for each of the floors and then filter based on the number of floors. I looked at the file you provided and I only see US buildings.
 

Crumbs

New Member
Joined
Jul 30, 2013
Messages
3
Thanks I'll try that out, never used one so I'll need to read about it a bit, unless you guys can send me specific instructions.
 

Crumbs

New Member
Joined
Jul 30, 2013
Messages
3
OK thanks a lot VoG and vavs, I read up a bit about pivot tables and indeed that did the trick. I always heard the name but never actually needed to use it, thanks!
 

Watch MrExcel Video

Forum statistics

Threads
1,122,940
Messages
5,598,975
Members
414,270
Latest member
skipolmsted

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