+ Reply to Thread
Results 1 to 6 of 6

Need to get my formula to check dates and use relevant one

  1. #1
    Registered User
    Join Date
    01-13-2014
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    64

    Need to get my formula to check dates and use relevant one

    I am trending study data and have results over a large time period however I only want to use the results in my formula that are with the specified date range (B6:B7).
    My formulas trend the values where they meet the criteria to produce a date. However should this trended date be outside the date range B6:B7, I want to use the value to the point where it uses B6 if its value is <B6 and B7 where the value is >B7. Conversly Should it's value be >B6 or <B7 I want to use the value generated.

    I have attached 2 examples of my problem and as usual any help is welcome and I thank you in advanced

    Thanks

    Gav
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Need to get my formula to check dates and use relevant one

    None of the formulas in your attachment reference cell B6 and only one of the 46 formulas reference B7.

    Are all of the formulas supposed to point to B6 and B7? I am quite, quite confused.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    01-13-2014
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: Need to get my formula to check dates and use relevant one

    Sorry for the confusion this is a poor explanation on my part now I look at it again. The one formula that does reference B8 was undergoing a change when I added this issue to the thread as it is a separate problem I have resolved.

    Hopefully a better explanation and I have pulled my study limit dates (B7:B8) from the main date to simplify the issue and hopefully make a solution easier. See (P4:P5)

    In column G each cell uses my formulas to trend the values where they meet the criteria I have stipulated and produce a date. If the date produced in the column G cell is earlier (<) P4 (01/09/2010) I need to use the date in P4 in the cell. Similarly if the Date in the Column G cell is later than (>) P5 (31/08/2013) I need to use the date in P5. should the dates lie between P4:P5 then I need to use the generated date. I have tried amending the formula to do this but appear to get a #NA when I should get a value due to an error in the formula I've written. Not sure I have the logic right but decided to use in my example the last working formula I had written.

    Hope this helps and sorry for the confusion.
    Attached Files Attached Files

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Need to get my formula to check dates and use relevant one

    You still haven't called out where you're trying to include/exclude the dates.

    Are the formulas in column I:J the ones you're troubleshooting? Also, what to do when the dates are equal?

    You need to choose a cell where you're applying this logic.

    This formula states if G4 is between P4 and P5, use G4. <=P4 use P4, >= P5 use P5.
    =IF(G4<=P4,P4,IF(G4<P5,G4,P5))
    Last edited by daffodil11; 03-13-2014 at 09:00 AM.

  5. #5
    Registered User
    Join Date
    01-13-2014
    Location
    Christchurch, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    64

    Re: Need to get my formula to check dates and use relevant one

    Sorry I missed it's only column G I'm wanting this to troubleshoot (tried a better explanation below). Columns I:J get the data from G and H respectively.

    Thanks for the formula you suggest but is there any way to employ it into the formula in G as the only way I've managed to work it is by the addition of the formula to a new column and from here reference the array formula (column I).

    If the date produced in the column G cell is earlier (<) P4 (01/09/2010) I need to use the date in P4 in the corresponding cell in G. Similarly if the Date in the Column G cell is later than (>) P5 (31/08/2013) I need to use the date from P5 in Column G cell. Should the dates lie between P4:P5 then I need to use the generated date in the cell it's generated in.
    Thanks again and sorry for confusion
    Last edited by Gavalar; 03-18-2014 at 04:23 PM.

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Need to get my formula to check dates and use relevant one

    Then it's just as simple as plugging what you have into the formula I've written.

    For every G4, plug the existing equation in its place.

    G4:

    =IF(G4<=$P$4,$P$4,IF(G4<$P$5,G4,$P$5)) becomes:


    =IF( IF(AND(ISBLANK(C3),D4<E4,D4>F4),TREND(C4,D4,H4),(IFERROR(IF(AND(D4>E4,D5>E4),NA(),IF(AND(D4<F4,D5<F4),NA(),IF(ISBLANK(C5),TREND(C4,D4,H4),TREND(C4:C5,D4:D5,H4)))),NA()))) <=$P$4,$P$4,IF( IF(AND(ISBLANK(C3),D4<E4,D4>F4),TREND(C4,D4,H4),(IFERROR(IF(AND(D4>E4,D5>E4),NA(),IF(AND(D4<F4,D5<F4),NA(),IF(ISBLANK(C5),TREND(C4,D4,H4),TREND(C4:C5,D4:D5,H4)))),NA()))) <$P$5, IF(AND(ISBLANK(C3),D4<E4,D4>F4),TREND(C4,D4,H4),(IFERROR(IF(AND(D4>E4,D5>E4),NA(),IF(AND(D4<F4,D5<F4),NA(),IF(ISBLANK(C5),TREND(C4,D4,H4),TREND(C4:C5,D4:D5,H4)))),NA()))), $P$5))

+ 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: 0
    Last Post: 03-11-2014, 11:48 AM
  2. [SOLVED] Check one cell, check second cell, return relevant value
    By NeroM in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-19-2014, 10:00 AM
  3. Check dates in range either same dates or different dates by formula
    By breadwinner in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-12-2013, 07:42 AM
  4. [SOLVED] Formula to check pre-defined list and show relevant info
    By galvinpaddy in forum Excel General
    Replies: 5
    Last Post: 07-05-2012, 02:43 AM
  5. Replies: 4
    Last Post: 05-09-2007, 07: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