+ Reply to Thread
Results 1 to 5 of 5

True or False if Number Lies Between a Certain Value

  1. #1
    Registered User
    Join Date
    01-13-2014
    Location
    Florida, United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    True or False if Number Lies Between a Certain Value

    I have an Excel workbook which has 10 rows of numbers with a min of 20 and max of 30. The random number lies in column B and this will be tested to see if it lies between the min and max. I need to loop this 10 time over

    I first started out declaring the 3 variables and assigning values to each variable. It works if I assign a value of 22 for Number but I want VBA to see the Number and make a decision (True or False) if that number lies within the range of 20 to 30.

    Should I name the Number variable as a variable because its value will change depending on if it matches the conditions? Also would a case be easier? Between.xlsx
    Last edited by AtomicDog; 04-11-2014 at 01:23 PM.

  2. #2
    Registered User
    Join Date
    01-13-2014
    Location
    Florida, United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: True or False if Number Lies Between a Certain Value

    Here is what I have so far

    Please Login or Register  to view this content.
    Last edited by AtomicDog; 04-08-2014 at 03:22 PM. Reason: Tags added

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: True or False if Number Lies Between a Certain Value

    Hi AtomicDog

    Do you really want Code?

    This Formula in E2, drag down appears to do as you require
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    01-13-2014
    Location
    Florida, United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: True or False if Number Lies Between a Certain Value

    Quote Originally Posted by jaslake View Post
    Hi AtomicDog

    Do you really want Code?

    This Formula in E2, drag down appears to do as you require
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    You're right, it doesn't require code but I'm trying to learn VBA and the basics. Even though your suggestion didn't directly lead me to the answer, it gave me the idea to use the macro recorder to use the AND statement on Excel to see what the code will be.

    I'm posting the code below, would you mind telling me what some of the lines mean? Why put R1C1 after formula? Why use RC[-8]?

    Please Login or Register  to view this content.
    Last edited by AtomicDog; 04-10-2014 at 11:03 AM.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: True or False if Number Lies Between a Certain Value

    Hi AtomicDog

    Good for you...need further help, let me know.

    You're welcome...glad I could help.

    If this resolves your issue please mark your Thread as SOLVED.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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. What is best to use for helper cells 0 or 1, typed true or false or =true =false
    By Gingermuppet in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2014, 10:41 PM
  2. [SOLVED] in this TRUE OR FALSE function, i want desired name instead of display true or false
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-15-2013, 06:44 PM
  3. Replies: 5
    Last Post: 01-26-2009, 12:18 AM
  4. counting number of dates AND check for true false
    By Whisper1 in forum Excel General
    Replies: 1
    Last Post: 01-30-2007, 04:50 PM
  5. Convert TRUE/FALSE results to a number
    By pomalley in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-16-2005, 02:06 PM

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