PDA

View Full Version : Trouble with calculations in Excel table



Crumbs
07-30-2013, 12:47 PM
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 (just remove spaces, file was too large for attachment):

ht tps: //docs . google . co m/file/d/0B-4vUrIGZBqoMktsN1VYSU5aSDg/edit?usp=sharing​

rollis13
07-30-2013, 01:19 PM
Cross-post:
http://www.excelguru.ca/forums/showthread.php?1955-Trouble-with-calculations-in-Excel-table&p=8602#post8602
http://www.excelforum.com/excel-programming-vba-macros/943491-trouble-with-calculations-in-excel-table.html?p=3344977#post3344977
http://www.mrexcel.com/forum/excel-questions/717169-trouble-calculations-excel-table.html

Crumbs
07-30-2013, 01:35 PM
Thanks folks but I got help in another forum.

SamT
07-30-2013, 01:36 PM
For the national counts:
In column AB, starting in AB2 list the possible floor numbers,ie;12 to 105.

In Column AC2 place this formula
=SUMIF(C:C,AB2,Z:Z)Copy it down to the bottom of the list of floor numbers

I don't understand the problem with state counts, you already have those results in column AB