+ Reply to Thread
Results 1 to 7 of 7

Selecting range in a column based on another cell value

  1. #1
    Registered User
    Join Date
    01-16-2018
    Location
    New South Wales
    MS-Off Ver
    2016 64-Bit
    Posts
    34

    Selecting range in a column based on another cell value

    Hello all,

    I have a spreadsheet that has values that go up by intervals of 10 that extends from 500 to 1500; however each value occurs more than once (so the value 500 might occur 150 times, and 510 might occur 285 times etc). This data is in Column A. In cell B1, I have a value (e.g. 886). I want to be able to select the points before and after that interval. So it select all cells that are contain 880 and 890 and copies them to cell C1. Also if the cell in B1 changes, the range that is selected also changes to select the appropriate range of cells.

    Any help would be greatly appreciated!

    Thanks!

    Edit: Sorry for the error, but I've cross posted this to "https://www.mrexcel.com/forum/excel-questions/1062781-selecting-range-column-between-two-values.html#post5103684"
    Last edited by nekmat97; 07-11-2018 at 08:36 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Selecting range in a column based on another cell value

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Selecting range in a column based on another cell value

    nekmat, Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Please make sure to include the full link, so that other members will be permitted to continue helping you

    Note that if you have fewer than 10 posts, you may need to type the link, or past it in pieces (or ask a mod to do that for you)

    https://www.mrexcel.com/forum/excel-...wo-values.html

  4. #4
    Registered User
    Join Date
    01-16-2018
    Location
    New South Wales
    MS-Off Ver
    2016 64-Bit
    Posts
    34

    Re: Selecting range in a column based on another cell value

    Sorry for breaking the rules. I've posted the link in the main post.
    I will also post this link to the other forum as well. Next time I'll just stick to one forum. Thanks for letting me know.

    I've also attached a dummy spreadsheet, basically the values that surround the value in cell B1 should be copied to cell C2. I.e. cells A23:A54 copied to C1. However, if the value in "B1" changes, the range that is copied should also change.

    Thanks,

    My apologies again for the cross-post.
    Attached Files Attached Files

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Selecting range in a column based on another cell value

    Try this:

    Please Login or Register  to view this content.
    Last edited by xladept; 07-11-2018 at 10:03 PM. Reason: No Header
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  6. #6
    Registered User
    Join Date
    01-16-2018
    Location
    New South Wales
    MS-Off Ver
    2016 64-Bit
    Posts
    34

    Re: Selecting range in a column based on another cell value

    Thank you so much. This works perfectly.

    Could you explain to me how the lines below work:
    Please Login or Register  to view this content.
    Also is there an extra line that you could add that copies all the contents from the range to column D.

    Thank you so much for your help.
    Last edited by nekmat97; 07-11-2018 at 10:33 PM.

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Selecting range in a column based on another cell value

    You're welcome and thanks for the rep!

    Well, if you have a continued line ( space underscore) it's like having your "If" one a single line and, with the colon you can add an action without needing the "End If":

    Please Login or Register  to view this content.
    The next line is just a regular action to concatenate the tail of the range:

    Please Login or Register  to view this content.
    Maybe:

    Please Login or Register  to view this content.

+ 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] Selecting a Range based on known cell positions
    By im00r3 in forum Excel General
    Replies: 5
    Last Post: 04-25-2018, 09:06 PM
  2. Selecting data range based on another column's values
    By ostbert in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-28-2014, 06:23 AM
  3. [SOLVED] Help with selecting a range based on the value of a cell
    By jaredj34 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2014, 12:22 PM
  4. Selecting a column range based on a value in header row
    By Ad83 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2012, 05:29 PM
  5. Selecting a column range based
    By dems in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-09-2010, 11:47 AM
  6. Selecting a range based on cell value
    By alpha1980 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-26-2008, 07:19 AM
  7. Selecting range based on adjacent column
    By yaju1120 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2007, 10:41 AM

Tags for this Thread

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