+ Reply to Thread
Results 1 to 6 of 6

Nested IF Statements Many Criteria

  1. #1
    Registered User
    Join Date
    11-09-2017
    Location
    Not your house
    MS-Off Ver
    2016
    Posts
    1

    Nested IF Statements Many Criteria

    Capture.PNG

    I need some serious Excel help on this one.

    In column D I have over 7000 decimal dates ranging from the mythical year 0 to 1999.

    In Column Q I have a sample value of sulfate (SO4).

    In Column V I have a list of years that are acting as my year range.

    In Column AB I have a threshold that samples in Column Q must be above. This value represents an average between two dates from Column V. 1.485 is the average I found between years 1974 and 1999.

    If the sample is above the threshold, I would like to have TRUE appear in Column S.

    I need my IF statment to look at the value in Column Q, decide if the associated date in Column D is between 2 years in Column V. If it is, then look at the value from Column Q and see if it is above the associated value in Column AB. If it is, then say TRUE in Column S, if not, then leave blank or return FALSE.

    For example, Q5 has value 0.59497 and is dated as 1998.96. Is this value greater than the 1.485 average from 1974 - 1999? No, then Column S should express this.

    Help!
    Last edited by cglor; 11-09-2017 at 08:23 PM. Reason: Wrong image attached

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Nested IF Statements Many Criteria

    An image attachment has very little value. Just attach the Excel file. It's easier than taking a screenshot first and then attaching that.

    It will be much easier to understand your problem if you provide your file. This allows us to see and experiment with your data, layout, formulas, and possibly attach a file with a completed solution.

    Under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.

    Your file may be too large to attach as an Excel file. If so, zip it and try attaching the zip file, which is allowed to be larger.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Nested IF Statements Many Criteria

    what on earth is a decimal date?
    what (real) date would something like 1998.96 represent? 0.96 of a year - 350.4 days?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Nested IF Statements Many Criteria

    Hi all- cglor, this would have been much easier with workbook data ready to test. Paste it in S2 and copy down:
    =INDEX($AB$2:$AB$19,MATCH(INT(D2),$V$2:$V$19,-1)+1)<Q2


    2017-NOV-11 12:58 - Use the following formula instead. See post #6 for explanation.
    Please Login or Register  to view this content.
    NOTE: The formula yields TRUE or FALSE. It assumes column V contains STARTING dates for each period, so the 1974 threshold applies to 1/1/1974 - 12/31/1998.
    Attached Files Attached Files
    Last edited by leelnich; 11-11-2017 at 02:27 PM. Reason: Added updated workbook & formula
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Nested IF Statements Many Criteria

    Quote Originally Posted by FDibbins View Post
    what on earth is a decimal date?
    what (real) date would something like 1998.96 represent? 0.96 of a year - 350.4 days?
    The way I interpreted this was that it is not a date, it's more of a serial number where the first four digits are the year when the data was recorded. For the purposes of this analysis the only part that matters is the year.

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Nested IF Statements Many Criteria

    Quote Originally Posted by 6StringJazzer View Post
    For the purposes of this analysis the only part that matters is the year.
    Agreed. The period dates (column V) are integers - I took them to refer to the first moment of the year -, so I used the integer portion of the measurement dates (column D) for comparison. However, the original formula in post #4 would fail with any dates greater than 12/31/1999 because of the way MATCH works*. I have amended said post with a more robust version.

    *MATCH with a match_type of -1 finds the smallest value greater than or equal to the match_value. This type works with lists sorted in descending order, but fails if the list doesn't contain such a value. To work with 21st century dates, the original formula would have required an amendment to your list as follows:

    Row\Col
    V
    AB
    AC
    1
    Starting date Threshold
    2
    2024
    3
    1999
    1.144862
    Applies to period 1/1/1999 - 12/31/2024
    4
    1974
    1.241145
    Applies to period 1/1/1974 - 12/31/1998
    Last edited by leelnich; 11-11-2017 at 02:20 PM.

+ 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. If statements in VBA to look at multiple criteria without a nested formula
    By PFDave in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-23-2016, 11:05 AM
  2. [SOLVED] Nested Sumif's or how to sum data based on nested criteria
    By dlietz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-07-2014, 11:36 AM
  3. [SOLVED] Nested if statements containing multiple and statements
    By John M. in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-22-2014, 11:48 PM
  4. questions with if statements and nested if statements
    By Pat Excel in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-03-2013, 01:41 PM
  5. Multiple nested IF statements and AND statements
    By TonyGetz in forum Excel General
    Replies: 2
    Last Post: 12-14-2010, 03:07 AM
  6. Nested If statements / logic statements
    By Brainless_09 in forum Excel General
    Replies: 3
    Last Post: 06-17-2009, 02:59 PM
  7. Replies: 12
    Last Post: 05-15-2009, 08:38 AM

Tags for this Thread

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