+ Reply to Thread
Results 1 to 11 of 11

Select row that is between two values

  1. #1
    Registered User
    Join Date
    04-10-2012
    Location
    Puerto Rico
    MS-Off Ver
    Excel 2010
    Posts
    20

    Select row that is between two values

    I have a little suggestion, can some one help with this macro

    I will like to color a row red if a cell is between two values, the trick is this is the range can be 2000-0000-00 to 3000-0000-00 or 2000-0000 to 3000-0000. The range is really between the first four numbers.
    Last edited by drsiaca; 05-03-2013 at 06:42 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,938

    Re: between two

    Hi and welcome to the forum

    We would love to help you with your question, but 1st, in accordance with forum rule, please rename your thread to something more meaningful, that actually describes your problem.

    Because thread titles are used in searching the forum it is vital they be written to accurately describe your thread content or overall objective using ONLY search friendly key words. That is, your title used as search terms would return relevant results.

    Also, many members will look at a thread title, and if it is of interest to them, or it falls within their area of expertese, they might only open those threads.

    Look at it this way...if you typed that title into google, what would you expect to get back?
    To change a Title on your post, click EDIT on you're 1st post, then Go Advanced and change your title
    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
    Registered User
    Join Date
    04-10-2012
    Location
    Puerto Rico
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Select row that is between two values

    Sorry about that

  4. #4
    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,938

    Re: Select row that is between two values

    Quote Originally Posted by drsiaca View Post
    I will like to color a row red if a cell is between two values, the trick is this is the range can be 2000-0000-00 to 3000-0000-00 or 2000-0000 to 3000-0000. The range is really between the first four numbers.
    by 1st 4 numbers, do you mean btw 2000 and 3000?

    If so, you can use conditional formatting for this, you dont need a macro.

    1. highlight the range you want to apply the conditional formatting to
    2. on the home tab, styles, select CF
    3. select new rule, select use formula
    4. enter =AND(A6>=2000,A6<=3000) format fill red

  5. #5
    Registered User
    Join Date
    04-10-2012
    Location
    Puerto Rico
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Select row that is between two values

    I tried that, what is causing me the problem is the hyphen. The hyphen cannot be deleted because it is part of a serial number. I will like it to be a macro

  6. #6
    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,938

    Re: Select row that is between two values

    so the actual cell value is 2000-0000-00 ?

    If so, you can extract that value with this...

    =AND(LEFT(A1,FIND("-",A1,1)-1)*1>=2000,LEFT(A1,FIND("-",A1,1)-1)*1<=3000)
    Last edited by FDibbins; 05-03-2013 at 08:51 PM.

  7. #7
    Registered User
    Join Date
    04-10-2012
    Location
    Puerto Rico
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Select row that is between two values

    Does not seem to work

    Thanks

  8. #8
    Registered User
    Join Date
    04-10-2012
    Location
    Puerto Rico
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Select row that is between two values

    Can this be achieved via macro?

  9. #9
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Select row that is between two values

    Yes you could try a macro like this and see if that works for you.

    Please Login or Register  to view this content.
    Alf
    Last edited by Alf; 05-06-2013 at 08:07 AM. Reason: Better code

  10. #10
    Registered User
    Join Date
    04-10-2012
    Location
    Puerto Rico
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Select row that is between two values

    This one worked for me.

    Please Login or Register  to view this content.



    Thanks guys
    Last edited by drsiaca; 05-07-2013 at 05:27 PM.

  11. #11
    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,938

    Re: Select row that is between two values

    drsiaca...Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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