+ Reply to Thread
Results 1 to 4 of 4

Nested IF with intervals

  1. #1
    Registered User
    Join Date
    09-28-2018
    Location
    Firenze
    MS-Off Ver
    2016
    Posts
    5

    Nested IF with intervals

    Hey, I need to make a formula to calculate transport costs:

    if weight is above 50 kg and below 100 → 20 €
    if weight is between 100 and 200 → 40 €
    if weight is between 200 and 300 → 60 €

    It goes on like this for every hundred kilogram adding 20 euros. Is there a smart way to do this?
    Last edited by SimoL; 04-19-2019 at 06:54 AM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Nested IF with intervals

    You don't say what it should cost if it is less than 50kg - I've assumed it is "too light" in the following.

    You could use this formula in B2, assuming the weight is in A2:

    =IFERROR(MATCH(A2,{50,100,200,300,400,500})*20,"too light")

    Just add more increments of 100 after the 500 if you need them. Here's an alternative:

    =IF(A2<50,"too light",(INT(A2/100)+1)*20)

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    09-28-2018
    Location
    Firenze
    MS-Off Ver
    2016
    Posts
    5

    Re: Nested IF with intervals

    Both work great, thanks Pete.

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,751

    Re: Nested IF with intervals

    looks like you are rounding up to the nearest 100 and then taking 20% of that number
    But to be sure
    try
    =Roundup(cell with weight, -2 )
    that rounds up to nearest 100
    then take 20%
    =Roundup(cell with weight, -2 ) * 0.2

    is that what you are after

    if not attach a sample sheet with examples and expected results

    does not take < 50 into account, which we can add an IF
    Last edited by etaf; 04-19-2019 at 06:52 AM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

+ 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. Replies: 9
    Last Post: 07-20-2017, 01:35 PM
  2. Replies: 1
    Last Post: 09-27-2016, 12:41 AM
  3. Calculating quantiies from irregular intervals to regular intervals
    By abhi1421 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-15-2014, 06:34 AM
  4. [SOLVED] controlling whether a list of intervals overlaps with a second list of intervals
    By Nicolas951 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-22-2013, 03:47 PM
  5. [SOLVED] Copy With Intervals Paste With No Intervals.
    By gorinw10 in forum Excel General
    Replies: 12
    Last Post: 07-20-2013, 12:23 PM
  6. Converting Data in Irregular Time Intervals into Regular Time Intervals
    By AlexJT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2011, 02:42 AM
  7. Need to Transpose Irregular Time Intervals into Regular Time Intervals
    By AlexJT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2011, 08:30 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