Energy Star Data

MarkRA

New Member
Joined
Jun 27, 2012
Messages
6
Hi folks, I'm a university student interning in the real estate industry for the summer and am working with some Energy Star (ES) data as one of my assigned projects.

I'm looking to create a macro to prepare data downloaded from ES into a usable format and produce several charts, including year-over-year comparisons of energy and water consumption and greenhouse gas emissions.

The first problem I'm having is generating a region column based on a state name column. I'd like to take the ES-reported state names - which are fully spelled out as such "California" "District of Columbia (D.C.)" etc - and assign them to a particular region of my choosing (New England states + NY, NJ, PA, DE = Northeast) etc.

I was thinking about using a very long nested string function for this, but I'm sure there must be an easier way!

Thanks in advance
 
Alright - so I've successfully created the table and implemented the vlookup formula. Your code above brings up an interesting point - I want to be able to run this on whichever sheet is currently open. People will be pulling new data down from ES on a monthly basis to perform this operation.

I don't have any experience with VBA, but it looks to me like I can just eliminate the "with/end with" <with worksheets("data")=""> and <end with=""> and this will run on the currently open sheet.

Are there any recommended resources out there for learning VBA? I hate bothering you guys with such basics as what "dim lastrow" <dim lastrow="" as="" long=""> means.</dim></end></with>
 
Last edited:
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Mark

You can't just remove the With/End With but you could replace Worksheets("Data") with ActiveSheet.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

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
Back
Top