+ Reply to Thread
Results 1 to 6 of 6

If statement

  1. #1
    Registered User
    Join Date
    01-19-2009
    Location
    earth
    MS-Off Ver
    2013
    Posts
    19

    If statement

    This is probably more complicated than my title lets on , but hopefully not.

    I am looking to Autocalculate a cost based on size range but am not sure how to write the statement.

    Example:
    400-1500 sqft = $11/sqft
    1501-2400 sqft = $10.50/sqft
    2401-2900 sqft = $9.50/sqft
    2901+ sqft = $8.50/sqft

    So, if A1 was the sqft column and had a value of 1000 then B1 should return $11,000 (1000x$11). If A1 was 2000sqft then B1 should return $21,000 (2000x$10.50)

    Something like IF(A1>=400,11*A1,IF(A1>=1501,10.5*A1,IF(A1...
    I'm not sure how to use multiple IFs with ranges as a check.

    Thanks
    -D

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    =a1*lookup(a1,{0,400,1501,2401,2901},{0,11,10.5,9.5,8.5})

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    =LOOKUP(A1,{0,400,1501,2401,2901},{0,11,10.5,9.5,8.5})*A1
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,

    It's probably easier, and certainly more flexible, to use a VLOOKUP Table.

    Put the following table in a range somewhere and give the range a name - say 'Prices'

    Please Login or Register  to view this content.
    Now in B1 use the formula below and copy down.

    Please Login or Register  to view this content.
    HTH

  5. #5
    Registered User
    Join Date
    01-19-2009
    Location
    earth
    MS-Off Ver
    2013
    Posts
    19
    That worked! Thanks Richard.

    -D

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    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)

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