+ Reply to Thread
Results 1 to 13 of 13

If number between then show...

  1. #1
    Registered User
    Join Date
    10-08-2015
    Location
    Gothenburg
    MS-Off Ver
    2016
    Posts
    78

    If number between then show...

    I'm creating sort of a "calculator" that will show a specific Zone. So I got 8 different zones 1-8. Each zone got a span of kilometers. So Zone 1 (0-3km) Zone 2 (3-6km) and so on...

    So if the total distance is 8km I want it to show "Zone 3" I tried to use the "IF" formula but kinda unsure how to code it to feel everything between 0-30km and then specify the correct Zone for it.

    Someone willing to help me out?

  2. #2
    Forum Contributor
    Join Date
    08-23-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: If number between then show...

    Hello,

    You could probably use "IF" statements all nested together here,

    first you'd need to seperate each zone for sure. I mean, if the distance is 3km, then the formula wouldn't know which zone to pick between 0-3 and 3-6. You can fix this by saying that zone 2 is 3.01 to 6 (or zone 1 is 0 to 1.999).

    Then you make the formula:

    Please Login or Register  to view this content.
    I put my KM value in cell D1, then wrote the lower limit in column A and the upper limit in column B. The IF only looks at the upper limit and because I work from lowest to highest in the formula, the result is the one that comes last (IE the highest possible zone). When you have done the 7 zones, you would put ",Zone8" as the last "[value_if_False]" because the number should be higher than the upper limit of zone 7. This isn't perfect - a value of 1000 would result in a "zone8" result, as would the word "Hello"
    Please let me know if this works for you.

    Oh, and if you want to refer to a cell where the zone is mentioned, just change the formula to state the cell instead of "Zone1" etc.
    Last edited by jayherring86; 05-27-2016 at 08:17 AM.
    IF("helping me", "thanks", "need more detail?")

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: If number between then show...

    What are the ACTUAL values of the different zones in kilometres?
    Zone 1 is 0-3
    Zone 2 is 3-6

    "and so on" isnt much help
    "and so on" implies they are set every 3 kilometres but that may not be the case.

    What are they EXACTLY?
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If number between then show...

    Quote Originally Posted by Challebjoern View Post
    So if the total distance is 8km I want it to show "Zone 3"
    Will the distances ALWAYS be whole numbers?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    10-08-2015
    Location
    Gothenburg
    MS-Off Ver
    2016
    Posts
    78

    Re: If number between then show...

    Quote Originally Posted by Special-K View Post
    What are the ACTUAL values of the different zones in kilometres?
    Zone 1 is 0-3
    Zone 2 is 3-6

    "and so on" isnt much help
    "and so on" implies they are set every 3 kilometres but that may not be the case.

    What are they EXACTLY?
    Oh, my bad.
    They are like this

    Zone 1 - 0-3km
    Zone 2 - 3-6km
    Zone 3 - 6-10km
    Zone 4 - 10-14km
    Zone 5 - 14-18km
    Zone 6 - 18-22km
    Zone 7 - 22-26km
    Zone 8 - 26-30km

  6. #6
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: If number between then show...

    Is a distance of 3 km exactly zone 1 or zone 2?

    If each zone is 3 km in length I'd do it this way.

    =int(A1/3) +1
    to get the zone number
    Where A1 is your distance
    Happy with my advice? Click on the * reputation button below

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If number between then show...

    Quote Originally Posted by Challebjoern View Post
    They are like this

    Zone 1 - 0-3km
    Zone 2 - 3-6km
    Zone 3 - 6-10km
    Zone 4 - 10-14km
    Zone 5 - 14-18km
    Zone 6 - 18-22km
    Zone 7 - 22-26km
    Zone 8 - 26-30km
    If the distance is 3km which zone is it? Zone 1 or Zone 2?

    See how all of your distances overlap?

  8. #8
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: If number between then show...

    Ok just saw your post #5.

    Why not use a vlookup?

  9. #9
    Registered User
    Join Date
    10-08-2015
    Location
    Gothenburg
    MS-Off Ver
    2016
    Posts
    78

    Re: If number between then show...

    Quote Originally Posted by Tony Valko View Post
    If the distance is 3km which zone is it? Zone 1 or Zone 2?

    See how all of your distances overlap?
    We can do it like this instead.

    Zone 1 - 0-3km
    Zone 2 - 3,1-6km
    Zone 3 - 6,1-10km
    Zone 4 - 10,1-14km
    Zone 5 - 14,1-18km
    Zone 6 - 18,1-22km
    Zone 7 - 22,1-26km
    Zone 8 - 26,1-30km

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,202

    Re: If number between then show...

    Please Login or Register  to view this content.
    Table above in A1:B8

    Assumes Zone 2 (etc) >3 and <= 6
    Km in C1

    in D1

    =VLOOKUP($C$1,$A$1:$B$8,2,1)

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If number between then show...

    One way...

    Create the table as shown in D1:E8...

    Data Range
    A
    B
    C
    D
    E
    1
    Distance
    Zone
    Zone 1
    0
    2
    3.1
    Zone 2
    Zone 2
    3.1
    3
    Zone 3
    6.1
    4
    Zone 4
    10.1
    5
    Zone 5
    14.1
    6
    Zone 6
    18.1
    7
    Zone 7
    22.1
    8
    Zone 8
    26.1
    9
    ------
    ------
    ------
    ------
    ------


    This formula entered in B2:

    =INDEX(D1:D8,MATCH(A2,E1:E8))

  12. #12
    Registered User
    Join Date
    10-08-2015
    Location
    Gothenburg
    MS-Off Ver
    2016
    Posts
    78

    Re: If number between then show...

    Sweet! Thanks alot guys for the quick answer! ++++++ Rep for everyone!

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: If number between then show...

    You're welcome. We appreciate the feedback!

+ 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. Can I have a message box show a specified number of times and then not show again?
    By gmr4evr1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2016, 07:50 PM
  2. Enter a number in excel and show a different number
    By ijl0322 in forum Excel General
    Replies: 2
    Last Post: 02-25-2015, 04:12 AM
  3. [SOLVED] automatically show the equivalent number in column B depending on the number in columnA
    By Elainefish in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-31-2013, 04:19 AM
  4. Find highest number of sales in a date range and show seller and sale number
    By audiofreak in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-06-2012, 03:34 AM
  5. [SOLVED] Macro to show how many times one number appears with another number
    By Omega71 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2012, 10:53 AM
  6. Replies: 2
    Last Post: 03-25-2010, 03:52 PM
  7. Replies: 4
    Last Post: 01-02-2007, 07:50 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