+ Reply to Thread
Results 1 to 7 of 7

Selecting a dynamic range of data based off column data

  1. #1
    Registered User
    Join Date
    05-27-2014
    Posts
    4

    Selecting a dynamic range of data based off column data

    I need to apply a function to a range of data. The data range changes each time I pull the data.

    I would like to script a macro that will change the range as the data changes.

    But the data I am working with...is a bit complicated.

    For example:
    I need to apply a function to multiple ranges of data in a worksheet. The row range of data is in between 2 strings that is listed on column B, (i.e. start, end). BUT the columns range is between C-G. I need select the range in column C-G but between the rows listed in column B.

    I am having the hardest time figuring out how to select the row range...based off the data in a different column...

    Any help will be very helpful.

    Thanks.

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Selecting a dynamic range of data based off column data

    Post a sample workbook and indicate what you are trying to do with a simple example
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Registered User
    Join Date
    05-27-2014
    Posts
    4

    Re: Selecting a dynamic range of data based off column data

    I have attached the sample data.

    So within a particular worksheet I have multiple buildings with cozy, small, medium and Large. (In sample attached no large). I need to select/apply each room type and find the % that is not empty. So in attached i need to select E7:L23, E25:L36, E38:L43.

    So I was hoping to create a macro that would search for the string Cozy and Cozy Total and have the in between be the row range. I will know the column ranges.

    So I am not sure if my approach is the best way of getting what I want. This data is from a pivot chart...and I've tried different kind of summaries and it isn't give me the outcome I need, such is with life.

    Thanks for looking into this, I really appreciate it.

    SAMPLE.xlsx

  4. #4
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Selecting a dynamic range of data based off column data

    If you have a pivot chart, then you have the pivot table AND the pivot table DATA.

    It seems like you are trying to recreate the wheel by working backwards from a pivot chart. What are you trying to accomplish and do you have the pivot table AND data? If not how do you get it?


    Also I still dont have any idea what you are trying to do with this data

  5. #5
    Registered User
    Join Date
    05-27-2014
    Posts
    4

    Re: Selecting a dynamic range of data based off column data

    Yes, my data is based off a pivot chart. Thank you for being patient... haha.

    I have many buildings listed in a spreadsheet with the room types(cozy,small.medium, large). I am doing a 2 week time span. So I know my column data. But rooms can get added or removed between each time I grab the data. So my row value always changes. I care about 6 hours in the day for 10 work days. If I have 2 cozies in a building there is a total of 120 bookable hours. I need to find how free a type of room is at any given time during the day.

    But I am running into 2 issues with the pivot chart. So these are room booking data and the data includes all bookings made within an hour. I don't really care about how often a room gets booked in an hour. I just care that it was booked. So my pivot chart is coming up with 1,2,3 sometimes 4. Which skews the data. Two, seems like the pivot table doesnt want to summaries the data the way I need it. It doesn't give me a break down of each room type and how full/empty it is. It does it for the total building.

    I currently go through and manually select each section of data and apply a function to get what I want. But I figure since I do this all the time, I mind as well automate it. Maybe I am just thinking about it all wrong.

  6. #6
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Selecting a dynamic range of data based off column data

    1) I would absolutely automate that nonsense.

    2)How can you get data from the underlying pivot table or the pivot table data itself?
    You are trying to recreate the wheel when you could just grab the underlying data and manipulate IT to get to what you want easier.
    3) Post the data, with the pivot, with the chart IF you insist lol and include a layout of what you are trying to accomplish, with fixed numbers if you have to but make it clear so I/we can assist.

    I think it might be easier than you think but I would simply NOT try to build some automated reporting off of data from a pivot chart because it could change and all your time is wasted, and the data set is not very pretty or standardized. Yuck

  7. #7
    Registered User
    Join Date
    05-27-2014
    Posts
    4

    Re: Selecting a dynamic range of data based off column data

    I have attached the data and pivot chart.

    So as you can see in the pivot charts there is a 1 in the place where a room was book in that hour. But a 2 or 3 would show up if a room is booked more than once. That throws off the data.

    I need to answer this question. How likely is one able to find a room, of each room type, in each building in the given hour range.

    Thanks Miketron! My head has been spinning around this for weeks.

    sample data.xlsb

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Excel VBA - Selecting dynamic range from Multiple Column data
    By Vinod Krishna.C in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-12-2014, 04:03 AM
  2. Replies: 7
    Last Post: 08-25-2012, 01:25 PM
  3. Selecting cells based on data in another column
    By seifer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2011, 07:43 AM
  4. Selecting rows based on data of one column
    By mtrant in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-18-2008, 03:27 PM
  5. Replies: 2
    Last Post: 12-09-2005, 11:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1