+ Reply to Thread
Results 1 to 10 of 10

Return value of 1 when the start date still running up to the end date or cancelled date

  1. #1
    Registered User
    Join Date
    03-24-2013
    Location
    Quezon City, Philippines
    MS-Off Ver
    Excel 2010/2013
    Posts
    83

    Return value of 1 when the start date still running up to the end date or cancelled date

    Hi,

    1.) I'm having a problem in my file which is I want to return a value of 1 when the contract start date is still running up to the contract end date -- it will exclude the all dates and consider only the dates in between.

    For example:
    The start date (column I) is November 20, 2014 and the end date (column K) is March 4, 2015. In this example, the month-year: November 2014 up to March 2015 will have a corresponding value of 1 and 0 to the other dates.

    September 2014 October 2014 November 2014 December 2014 January 2015 February 2015 March 2015 April 2015 May 2015
    0 0 1 1 1 1 1 0 0

    I used this formula which is I think is correct however I think this is too complicated. Is there anyway to simplify this code:
    Please Login or Register  to view this content.
    2.) The other problem is that I have a cancellation date (column M) -- date when the client cancelled the contract. This will be the new contract end date instead of the old contract end date.

    For example:
    The start date (column I) is November 20, 2014 and the end date (column K) is March 4, 2015 and there has a cancellation date (column M) of January 12, 2015. In this example, the month-year: November 2014 up to January 2015 will have a corresponding value of 1 instead of November 2014 up to March 2015.

    September 2014 October 2014 November 2014 December 2014 January 2015 February 2015 March 2015 April 2015 May 2015
    0 0 1 1 1 0 0 0 0

    3.) If the cancellation date column doesn't have any value, the date that will be considered will be the contract end date.

    For the 2nd and 3rd question, I'm having a hard time thinking of the formula that can be used.


    **Kindly disregard any duplicates in the raw data for now.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Return value of 1 when the start date still running up to the end date or cancelled da

    @ dylan copy paste below in A4 then drag down and across
    =IFERROR((SUMPRODUCT(--(TEXT(ROW(INDIRECT(INDEX(data!$H$1:$H$100,MATCH(Sheet1!$A4,data!$C$1:$C$100,0))&":"&IF(INDEX(data!$L:$L,MATCH(Sheet1!$A4,data!$C$1:$C$100,0))>0,INDEX(data!$J$1:$J$100,MATCH(Sheet1!$A4,data!$C$1:$C$100,0)),INDEX(data!$L$1:$L$100,MATCH(Sheet1!$A4,data!$C$1:$C$100,0))))),"MMMM YYYY")=B$2))>0)*1,"")

    change the references according to your actual data
    Last edited by hemesh; 01-24-2016 at 11:31 AM. Reason: removed file on request of OP as data was actual
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Registered User
    Join Date
    03-24-2013
    Location
    Quezon City, Philippines
    MS-Off Ver
    Excel 2010/2013
    Posts
    83

    Re: Return value of 1 when the start date still running up to the end date or cancelled da

    Quote Originally Posted by hemesh View Post
    =IFERROR((SUMPRODUCT(--(TEXT(ROW(INDIRECT(INDEX(data!$H$1:$H$100,MATCH(Sheet1!$A4,data!$C$1:$C$100,0))&":"&IF(INDEX(data!$L:$L,MATCH(Sheet1!$A4,data!$C$1:$C$100,0))>0,INDEX(data!$J$1:$J$100,MATCH(Sheet1!$A4,data!$C$1:$C$100,0)),INDEX(data!$L$1:$L$100,MATCH(Sheet1!$A4,data!$C$1:$C$100,0))))),"MMMM YYYY")=B$2))>0)*1,"")
    Works like a charm!! Thanks so much Hemesh, I have a problem encountered again because I do have duplicates however the data is not really a duplicate just a different values. for example in the data on that file I have:
    Account Start Date End Date Cancellation Date
    A. Osmena Realty Corporation July 2014 July 2015 September 2014
    A. Osmena Realty Corporation November 2015 May 2016 (blank)

    You will see in the 1st row of data that it was cancelled on September 2014 and in the next row it resumed again on November 2015 up to May 2016. This means that I need to have a formula that will give me this kind of table:
    April 2014 May 2014 June 2014 July 2014 August 2014 September 2014 October 2014 November 2014 December 2014 January 2015 February 2015 March 2015 April 2015 May 2015 June 2015 July 2015 August 2015 September 2015 October 2015 November 2015 December 2015 January 2016 February 2016 March 2016 April 2016 May 2016 June 2016 July 2016
    0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0

    Would this be possible? if not, should I first clean the data and then give a clean data to you?

    Thanks!

  4. #4
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Return value of 1 when the start date still running up to the end date or cancelled da

    @ Dylan ! The thing you asking related with duplicates a work around can be you can have same dups on second sheet and then we can fetch same data! Is that ok if so then let me know

  5. #5
    Registered User
    Join Date
    03-24-2013
    Location
    Quezon City, Philippines
    MS-Off Ver
    Excel 2010/2013
    Posts
    83
    Quote Originally Posted by hemesh View Post
    @ Dylan ! The thing you asking related with duplicates a work around can be you can have same dups on second sheet and then we can fetch same data! Is that ok if so then let me know
    Yes it is okay! However, the duplicates may have more than 1 or 2. What can we do about it? Thanks so much!

  6. #6
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Return value of 1 when the start date still running up to the end date or cancelled da

    @ Dylan, see the attachment sheet 2 I have kept the duplicate there and applied the formula, FYI i kept only One duplicate initially to show you other Dups you can manage in your actual sheet. formula in B4 remains the same you need to drag it down and cross to apply it to all cells.

    This is an array formula and you need to copy paste the formula in your sheet then hold control and shift together and then hit enter to confirm it as an array formula instead of just enter
    Once the formula is confirmed as an array in formula bar you can see curly braces {} surrounding your formula which we cannot type manually.
    Last edited by hemesh; 01-24-2016 at 11:29 AM.

  7. #7
    Registered User
    Join Date
    03-24-2013
    Location
    Quezon City, Philippines
    MS-Off Ver
    Excel 2010/2013
    Posts
    83

    Re: Return value of 1 when the start date still running up to the end date or cancelled da

    Quote Originally Posted by hemesh View Post
    FYI i kept only One duplicate initially to show you other Dups you can manage in your actual sheet.

    This is an array formula and you need to copy paste the formula in your sheet then hold control and shift together and then hit enter to confirm it as an array formula instead of just enter
    Once the formula is confirmed as an array in formula bar you can see curly braces {} surrounding your formula which we cannot type manually.
    Hi Hemesh,

    I see. last question, what if I have 2 or more duplicates? I'll just have the formula be in an array form? Or should the formula be expounded/elaborated for the 2 or more duplicates? If so, could you paste it here? the formula? I'll just do it on my actual sheet. I think that's more than enough help I need.


    Thank you so very much!!

  8. #8
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Return value of 1 when the start date still running up to the end date or cancelled da

    Same formula will work for any number of dup's. You just need to have dup's entry on sheet

  9. #9
    Registered User
    Join Date
    03-24-2013
    Location
    Quezon City, Philippines
    MS-Off Ver
    Excel 2010/2013
    Posts
    83

    Re: Return value of 1 when the start date still running up to the end date or cancelled da

    Thank you hemesh! You saved me a lot of work! Thank you very very very much!

  10. #10
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Return value of 1 when the start date still running up to the end date or cancelled da

    @Dylan you are welcome!

+ 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. [SOLVED] subset of range defined by start date and date date in dedicated cells
    By Pragmaticite in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-23-2015, 05:30 PM
  2. Counting if data falls on date between Start Date, End Date or Possible End Date
    By JessHasQuestions in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 07-26-2014, 08:01 AM
  3. Replies: 1
    Last Post: 10-02-2012, 02:42 PM
  4. Return cell value on calendar for all dates between start date & end date
    By mmctague in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-23-2012, 02:11 PM
  5. Replies: 2
    Last Post: 01-04-2012, 09:15 AM
  6. date between start & end date and return period
    By christy1125 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-04-2011, 03:08 PM
  7. Replies: 7
    Last Post: 11-16-2008, 05:48 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