+ Reply to Thread
Results 1 to 12 of 12

Formula to search for repeat values and return unique information

  1. #1
    Registered User
    Join Date
    05-28-2014
    Posts
    21

    Formula to search for repeat values and return unique information

    Okay,

    So I'm having a hard time coming up with a formula that will actively search through a column and compare multiple values for the same policy holder so that I can determine if a new policy is truly a brand new policy or a transfer of policy number.

    I can figure this out with a basic formula - if there the policy holder only had one policy. However, several of the policy holders have several existing policies and I'm at a loss as to a formula that would be able to "search" through their values and return something like "Transfer" in an adjacent column that would allow me to filter them out of a "New Policies" report.

    I've attached a sample file that shows my problem. The way to determine if it is a transfer is that the policy holder will have a new line item with a "Start Date" that is the same as on of their other policies "Cancellation Date". The policy holder "Tom" represents my exact dilemma - multiple policies with one obvious transfer, I just need a formula that can be applied to thousands and thousands of rows that I can then sort and eliminate the transfers.

    If anyone could help me with this, it would be greatly appreciated. I'm stuck.

    Thanks!
    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,944

    Re: Formula to search for repeat values and return unique information

    You use this to pullin duplicates...
    =IF(D2="","",INDEX($B$2:$B$10,MATCH(A2&D2,INDEX($A$2:$A$10&$C$2:$C$10,0),0)))

    or you could get a bit more fancy and use this...
    =IF(D2="","",INDEX($A$2:$A$10,MATCH(A2&D2,INDEX($A$2:$A$10&$C$2:$C$10,0),0))&" policy No. "&INDEX($B$2:$B$10,MATCH(A2&D2,INDEX($A$2:$A$10&$C$2:$C$10,0),0)))
    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
    Registered User
    Join Date
    05-28-2014
    Posts
    21

    Re: Formula to search for repeat values and return unique information

    Thanks FD,

    That looks like it does most of what I want... Can you think of a way to get it to return something like "Transfer" in the row of the newly opened policy though? Right now it is returning the policy number of the "new transfer" in the first line item for each policy holder. Without getting into too much detail, I need to the old policy that was cancelled to remain, but I want to be able to to use another formula to either include or exclude the data in the row based on whether or not that row is a new policy that was "Transferred" - because I don't want to count it as new if it is not.

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Formula to search for repeat values and return unique information

    If I'm reading your explanation correctly, then John's policy number 2 is a transfer and Tom's number 9 policy is a transfer. If this is correct, this will flag those policies.
    Formula in E2 and copy down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  5. #5
    Registered User
    Join Date
    05-28-2014
    Posts
    21

    Re: Formula to search for repeat values and return unique information

    Sky, that works great!

    Ugh, okay so one more twist. It appears that some of the policy transfers occur in the same month as the initial policy start.

    So, someone opens a brand new policy on 1/2/15 and then transfers the policy on 1/5/15 - in cases like these I actually do not want to identify it as a transfer... is there a way to exclude this using some variation of the formula you provided and the Month() formula?

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Formula to search for repeat values and return unique information

    I'm not following. I thought the policy cancelled date signified the transfer date by it being the same as the start date for another policy. So if these dates are different the policy would not be identified by the formula as a transfer?

  7. #7
    Registered User
    Join Date
    05-28-2014
    Posts
    21

    Re: Formula to search for repeat values and return unique information

    So, if you look at this new version of the file - Tom opened a new policy on 2/10/15 and then transferred it to a different policy on 2/18/15.

    My main goal is to generate a count of "Total Policies" and a count of "New Policies For the Month". So, in most cases transfers are made by policy holders several months or years after they start the policy - since this "Newly Transferred" policy is not actually a new policy but a change in an existing policy - I do not want to count it as a new policy.

    However, if a new policy is opened in February (as is the case with Tom) and then transferred in the same month - it is a transfer, but it is also a new policy for the month. The simplest solution would be to have the formula return nothing if this scenario occurs so that it doesn't get excluded with the other transfers. But I'm at a loss as to how to do that.

    Does that clarify it at all? Sorry for the confusion.
    Attached Files Attached Files

  8. #8
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Formula to search for repeat values and return unique information

    It would be best if you just explain what you want in the E column and why based on the exact data that's there. In other words I want this in column E because this happened in column D and there's this in column C and that date is 10 days past that etc. etc. that's all I need to know.

  9. #9
    Registered User
    Join Date
    05-28-2014
    Posts
    21

    Re: Formula to search for repeat values and return unique information

    I want Column E to say "Transfer" if a policy holder in column A has one policy with a cancellation date in column D that matches the start date of a different policy (Column C) for the same policy holder -- unless the policy for the two line items in question (the matching policy cancellation date in column D and the policy start date in column C) occurred in the same month of the same year, in this case I would like it to return nothing ("") instead of "Transfer" (which is what it is returning now).

    Thank you for all of your help with this, I really appreciate it.

  10. #10
    Registered User
    Join Date
    05-28-2014
    Posts
    21

    Re: Formula to search for repeat values and return unique information

    Sorry Duplicate

  11. #11
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Formula to search for repeat values and return unique information

    I think I'm there now.
    So policy #9 Tom is not a transfer because even though the start date matches the cancellation date of policy #7, policy #7 was itself only started 8 days previous in the same month and same year? If so my next question is how does that work? You say same month and same year, what if one was the last day of one month and the first day of the next month. Different month and year, but only one day apart? Do you really want same month and year or a minimum amount of days between when a policy was started and when it was cancelled before it can be considered a transfer?
    Last edited by skywriter; 02-19-2015 at 10:50 PM.

  12. #12
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Formula to search for repeat values and return unique information

    So read my post above and then look at this solution. So I built in a helper column F. This column can be hidden if it causes you problems. Basically F returns true if policy start date and policy end date are not in the same month. So I just add that to the original formula and as you can see Tom's policy #9 no longer shows transfer, but John's policy #2 is a transfer. If I got this wrong just let me know. I'm not that good at coming up with complicated formulas, though I have managed to pull quite a few of them out of my hat, it takes me forever to figure them out. I should have thought of a helper column earlier, it makes life so much easier. As per my post above if you have a situation where the start date is at or near the end of the month and the cancellation is in the beginning of the next month we could set the formula to go by how many days apart the two are. Say 30 for giggles.
    Good Luck!!!
    Attached Files Attached Files
    Last edited by skywriter; 02-19-2015 at 10:56 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. [SOLVED] A formula to return the average of unique values only
    By simonlblea in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-06-2023, 08:25 AM
  2. Array Formula To Return Unique Values From a Column Using a Value
    By lucas813 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 02-13-2015, 12:07 PM
  3. add to array formula to only return unique values
    By jason892 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-11-2013, 06:39 AM
  4. Excel 2007 - Formula or VBA to find unique names and return values?
    By kjwaller in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-02-2013, 09:09 PM
  5. Formula: return unique values
    By Bramjonker in forum Excel General
    Replies: 6
    Last Post: 06-19-2012, 12:22 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