+ Reply to Thread
Results 1 to 4 of 4

If statement based on cell data, if falls in range.

  1. #1
    Registered User
    Join Date
    10-26-2011
    Location
    Stoke, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    If statement based on cell data, if falls in range.

    Hello,

    I have attached a file that im having a little problem with, what i need to do is the following;

    I have worked out total hours between 2 dates, includign subtracting weekends. This is shown in column F.

    From this I need to know if the hours totalled fall within a certain criteria parameters. These are represented by the Priority code in column A, and the parameters are as follows;

    100 = 24hrs
    200 = 48hrs
    250 = 120hrs
    400 = 960hrs

    What I want to happen in column's in G:J is if the criteria is met then a '1' is placed into the revelant cell and a '0' is placed in the others. In the attached I shown an example of how it should look.

    There should only ever be a '1' in the matching priority code and column cell if the hours is with range.

    Please help.

    Chris.
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: If statement based on cell data, if falls in range.

    The answer should be this in G2, then copied down/across:

    =--($A2=G$1)


    Unfortunately you have some text strings (column A) that look like numbers, but aren't. So this is what you'll have to use unless you fix the data to all be actual numbers:

    =--($A2+0=G$1+0)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-26-2011
    Location
    Stoke, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: If statement based on cell data, if falls in range.

    This formula seems to put a '1' in the matched, but i should only have a 1 if the criteria is met, an example of this not working would be cell H4, this is a priority 200 therefore should have a value in column F of less then 48, but its value is actually is 158.11. So there should be '0' in all boxes G:J

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: If statement based on cell data, if falls in range.

    Try this

    =--(LOOKUP($F2,{0,24,48,120,960},{100,200,250,400,0})=G$1)

    Not following your logic with row 4. Shouldn't a 158 hr give a 400 code (between 120 and 960)?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ 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