+ Reply to Thread
Results 1 to 32 of 32

Need help to find policy start date by comparing poicy # & transaction date that falls wit

  1. #1
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Need help to find policy start date by comparing poicy # & transaction date that falls wit

    Hi, I need help from all the experts who can help me.
    I have a situation wherein 2 lists of data as following:

    Sheet 1 - Contains a Unique Policy number list which will have multiple lines repeating but with different transaction dates (which are basically a date a person entered who is maintaing daily enteries for purchases).

    Sheet 2- Contains a the same kind of Unique (policy#) number however has Policy Term dates (Every year a new policy is renewed for these unique numbers.

    What I need is I need to do is find the Term Start date and Expiration date for each Unique Policy date on Sheet 1 by comparing whether the Transaction date falls in which Term of that Unique Policy from Sheet 2.

    Note: A unique policy might have multiple Terms so we will have look first with the Policy# and then try to find whether my Transaction date falls in which Unique Policy numbes term and provide me the Start Date in a cell besides Transaction date and Expiration date of term besides the Start date of Term.

    Friends please help me out with this.
    Attached Files Attached Files

  2. #2
    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,926

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    This is a bit long-winded, but I think it gives you what you want...
    =IF(SUMPRODUCT(--($A$25:$A$39=A4),--($B$25:$B$39=B4),--($C$25:$C$39<C4),--(D25:D39>C4),($C$25:$C$39))=0,"",SUMPRODUCT(--($A$25:$A$39=A4),--($B$25:$B$39=B4),--($C$25:$C$39<C4),--(D25:D39>C4),($C$25:$C$39)))
    and...
    =IF(SUMPRODUCT(--($A$25:$A$39=A4),--($B$25:$B$39=B4),--($C$25:$C$39<C4),--(D25:D39>C4),($D$25:$D$39))=0,"",SUMPRODUCT(--($A$25:$A$39=A4),--($B$25:$B$39=B4),--($C$25:$C$39<C4),--(D25:D39>C4),($D$25:$D$39)))
    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

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Try this Macro

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi,

    I tried the formula suggested by you however it seems there is something missing in it. I just blank cell once I have added the formula to the cell. Could you please add the formula on the file and attach it back to this thread.

    Thanks a lot for your help.

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,913

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Enter your desired result for few transactions
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    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,926

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Im sorry, I had copied the data from sheet 2 to sheet 1 to make it easier to play around with, then forgot to adjust the formulas to work for sheet 2 Try thise...

    =IF(SUMPRODUCT(--(Database!$A$4:$A$18=A4),--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$C$4:$C$18))=0,"",SUMPRODUCT(--(Database!$A$4:$A$18=A4),--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$C$4:$C$18)))

    =IF(SUMPRODUCT(--(Database!$A$4:$A$18=A4),--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$D$4:$D$18))=0,"",SUMPRODUCT(--(Database!$A$4:$A$18=A4),--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$D$4:$D$18)))

  7. #7
    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,926

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    deleted forum-induced duplicate thread
    Last edited by FDibbins; 08-11-2014 at 12:51 AM.

  8. #8
    Forum Expert cbatrody's Avatar
    Join Date
    04-15-2014
    Location
    Dubai
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    2,136

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Alternatively,


    =IF(SUM(Database!$C$4:$C$18*(Database!$A$4:$A$18=A4)*(Database!$B$4:$B$18=B4)*(Database!$D$4:$D$18>=C4)*(Database!$C$4:$C$18<C4))=0,"",SUM(Database!$C$4:$C$18*(Database!$A$4:$A$18=A4)*(Database!$B$4:$B$18=B4)*(Database!$D$4:$D$18>=C4)*(Database!$C$4:$C$18<C4)))


    =IF(SUM(Database!$D$4:$D$18*(Database!$A$4:$A$18=A4)*(Database!$B$4:$B$18=B4)*(Database!$D$4:$D$18>=C4)*(Database!$C$4:$C$18<C4))=0,"",SUM(Database!$D$4:$D$18*(Database!$A$4:$A$18=A4)*(Database!$B$4:$B$18=B4)*(Database!$D$4:$D$18>=C4)*(Database!$C$4:$C$18<C4)))


    you need to confirm these by pressing CTRL+SHIFT+ENTER (array formula)


    I have updated the formula in the attached file.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi Mehmetcik,

    Your Macro worked very well however I need some more help from you in the same sample and macro.
    I had a scenario wherein the transaction date for one of the Row 10 on the sample file had date as 07/01/2013 and it has taken Policy Effective date as 07/01/2012 & Policy Expiration date as 07/01/2013. However I want it to find the next policy term i.e. I want the macro to find the next policy term if my Transaction Date and expiration date is same. So I desire to find Policy Effective date: 07/01/2013 & Policy Expiration date: 07/01/2014.

    Is this possible.

    Thanks
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi, I really appreciate your help with all this super coding but for some reason I am not getting my desired result. What I want is if a policy numbers transactions date is 07/01/2013 and for the same policies if there 3 terms starting from Policy Effective date 07/01/12 to 07/01/13 and Policy effective date 07/01/13 to 07/01/14. Then Macro should pick policy effective date as 07/01/13 and expiration date as 07/01/14.

  12. #12
    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,926

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Have you tried any of the suggested formulas yet?

  13. #13
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi yes I have tried but I am getting value error

  14. #14
    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,926

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    based on your sample data...
    A
    B
    C
    D
    E
    F
    G
    3
    Name
    Policy#
    Transaction Date (MM/DD/YYYY)
    Amount of Transaction
    Income from Transaction
    Policy Effective Date (MM/DD/YYYY)
    Policy Expiration Date (MM/DD/YYYY)
    4
    Adrian ABC456
    2/15/2014
    66
    6.6
    11/1/2013
    11/1/2014
    5
    Adrian ABC456
    11/1/2013
    78
    7.8
    11/1/2011
    11/1/2012
    6
    Adrian XYZ987
    4/12/2013
    99
    9.9
    7/3/2124
    7/4/2126
    7
    Adrian XYZ987
    5/15/2013
    45
    4.5
    10/1/2012
    10/1/2013
    8
    Adrian DEF100
    11/27/2011
    65
    6.5
    9
    Adrian DEF100
    10/27/2012
    56
    5.6
    12/1/2011
    12/1/2012
    10
    Flounder AAA787
    11/1/2013
    66
    6.6
    11
    Flounder AAA787
    12/12/2012
    78
    7.8
    12
    Flounder AAA787
    5/15/2011
    99
    9.9
    13
    Flounder AAA787
    5/15/2011
    45
    4.5
    14
    Flounder CCC989
    11/1/2013
    65
    6.5
    15
    Flounder CCC989
    7/1/2012
    56
    5.6
    16
    Flounder CCC989
    5/1/2011
    66
    6.6
    17
    Flounder CCC989
    12/17/2010
    78
    7.8
    18
    Flounder CCC989
    7/12/2012
    99
    9.9


    F4=IF(SUMPRODUCT(--(Database!$A$4:$A$18=A4),--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$C$4:$C$18))=0,"",SUMPRODUCT(--(Database!$A$4:$A$18=A4),--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$C$4:$C$18)))

    G4=IF(SUMPRODUCT(--(Database!$A$4:$A$18=A4),--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$D$4:$D$18))=0,"",SUMPRODUCT(--(Database!$A$4:$A$18=A4),--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$D$4:$D$18)))

    both copied down

  15. #15
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi, Thanks for the formula however if you look at the information I have given my thread you will find that I just want the formula to look for the Policy effective dates and expiration date by comparing the policy and transaction date only and not amount or name.
    Could you remake this formula as I tried but it does not seem to be working well and also the transaction date should fall in between the policy effective date and expiration date and the last request is if the transaction date is the expiration date of a given policy then please make the formula to pick the next policy effective date and its respective expiration date.

  16. #16
    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,926

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    OK so just remove the 1st part of that formula...
    =IF(SUMPRODUCT(--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$C$4:$C$18))=0,"",SUMPRODUCT(--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$C$4:$C$18)))
    and
    =IF(SUMPRODUCT(--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$D$4:$D$18))=0,"",SUMPRODUCT(--(Database!$B$4:$B$18=B4),--(Database!$C$4:$C$18<C4),--(Database!D4:D18>C4),(Database!$D$4:$D$18)))

  17. #17
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi, well the formula you gave is working well with little modifications I did on them by removing the freeze cells.

    You really did an awesome formula by pulling the Policy effective date and expiration date with Policy# & Transaction date.

    However if you see the results the formula does not pull any policy effective date and expiration date for a policy # and transactions date wherein the transaction date is either the Policy Effective start date or expiration date.

    Can you please try to edit the formulation to pull the Term wherein Transaction date and Policy effective date are same.

    Below is the editted formula and attached is the same file.

    F4 =IF(SUMPRODUCT(--(Database!B:B=B4),--(Database!C:C<C4),--(Database!D:D>C4),(Database!C:C))=0,"",SUMPRODUCT(--(Database!B:B=B4),--(Database!C:C<C4),--(Database!D:D>C4),(Database!C:C)))
    E4 =IF(SUMPRODUCT(--(Database!B:B=B4),--(Database!C:C<C4),--(Database!D:D>C4),(Database!D:D))=0,"",SUMPRODUCT(--(Database!B:B=B4),--(Database!C:C<C4),--(Database!D:D>C4),(Database!D:D)))
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi,

    The macro is still not giving the expected policy# and expiration date. Could you try once again.

    I need the Policy effective date and expiration date for those policies wherein the transaction date is same as the policy effective date.

  19. #19
    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,926

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    I will take another look at this for you

  20. #20
    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,926

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    OK, my formula was looking at greater and less than, I have added greater than and =, and less than and =

    =IF(SUMPRODUCT(--(Database!B:B=B4),--(Database!C:C<=C4),--(Database!D:D>=C4),(Database!C:C))=0,"",SUMPRODUCT(--(Database!B:B=B4),--(Database!C:C<=C4),--(Database!D:D>=C4),(Database!C:C)))

    Appy the same method to column G

  21. #21
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi FDibbins,

    I tried this formula but it didn't work. Formula pulled some number/date but that number/date does not exist in the workbook. I believe its not going through well.
    Last edited by arunroc; 09-13-2014 at 07:02 PM.

  22. #22
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi

    Can you place your required dated in column H.

    We will all be able to help you a lot easier.

  23. #23
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi mehmetcik,

    I have placed the required dates on the column H & I for your reference. Attached is the file. Please let me know if I can be of any further assistance to you.
    Attached Files Attached Files

  24. #24
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Try This Version:-
    Attached Files Attached Files

  25. #25
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Super thanks Sir you made my day. Thanks alot alot alot alot

  26. #26
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Hi mehmetcik,

    Am really sorry for this additional request to make changes to the macro but I am really stuck with a big mess. I have recently found that the database I have which contains all the policy numbers and there policy effective dates and expiration dates have been updated in a different manner.

    My colleagues had combined 2 or more policy numbers and loaded or created one single policy.
    For Example I have 3 Policies = 1. ABC123 2. DEF456 3. GHI789 and all these policies had same effective dates & expiration dates
    so my colleagues combined these 3 policy numbers and loaded them as ABC123/DEF456/GHI789

    However whenever I make my statement with transactions I will always have single policies in statement sheet.

    So I would request you to please help me with my this complex request, which is complex for me but I am sure its not that complex for you.

    What I want is a macro to select a policy given on Column B of Sheet Statement find it in Column B of Sheet Database, once it finds a match copy paste that policy back to Sheet Statement Column D.

    Once this information is pulled then I would request you to please add the code to find the policy effective dates and expirtion date the D column Policy #.


    I have uploaded a sample file with the required details and also mentioned what kind of result I wish the macro to pull on the wooksheet.


    Please please please please help me.
    Attached Files Attached Files

  27. #27
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    I don't understand.

    The Database is your master document right?

    You have the following entries:=
    ABC456/DEF789
    DEF100,GHI200
    XYZ987-XYZ999

    Don't you just want there broken out into individual rows?

    Your example shows something similar too, in D4 =
    Please Login or Register  to view this content.

    How is the data being transferred from the Database to the statement?

  28. #28
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    I think I just confused you with info. The data on D4 I had manually copy pasted from database statement sheet. And I want this step to be done by macro.
    Actually we have a billing department who creates transactions on the basis of individual policy numbers and these transactions then extracted to excel which I call statement however the another department who load the policies normally combine 2 or more policies and load one policy this the reason I earlier said that I found this unusual. So the policy number I pasted manually on D4 is just to make you understand that I want the clubbed policies and normally loaded policies to be pulled from database sheet to statement sheet on column D
    Last edited by arunroc; 09-20-2014 at 06:23 PM.

  29. #29
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    can you write code wherein it can copy the policy from poicy on statement sheet and then find it in Database sheet column B and then if it finds a policy in database sheet copy that policy and paste it on D column of Statement sheet. I will manage to edit the macro to find the dates with the macro you gave me earlier.

  30. #30
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    You did not answer my Question.

    You have the following entries:=
    ABC456/DEF789
    DEF100,GHI200
    XYZ987-XYZ999

    Don't you just want there broken out into individual rows?

    I will assume so and do that for you.

  31. #31
    Registered User
    Join Date
    04-26-2010
    Location
    Mumbai
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    Ok we can try what you are saying

  32. #32
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Need help to find policy start date by comparing poicy # & transaction date that falls

    You did not answer my Question.

    You have the following entries:=
    ABC456/DEF789
    DEF100,GHI200
    XYZ987-XYZ999

    Don't you just want there broken out into individual rows?

    I will assume so and do that for you.


    This Macro will make sure that there is only one invoice on a line in the database.
    Please Login or Register  to view this content.
    Last edited by mehmetcik; 09-21-2014 at 07:53 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. Replies: 2
    Last Post: 08-09-2014, 12:40 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: 4
    Last Post: 09-25-2013, 04:00 PM
  4. Determining if a datetime falls within start and end date times
    By migooz in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-25-2013, 03:05 PM
  5. Replies: 2
    Last Post: 01-04-2012, 09:15 AM

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