+ Reply to Thread
Results 1 to 8 of 8

Working out amount of data overlaps

  1. #1
    Forum Contributor
    Join Date
    03-05-2015
    Location
    norwich
    MS-Off Ver
    365
    Posts
    107

    Working out amount of data overlaps

    I'm trying to work out how much data is overlapping in the attached

    Essentially I have 3 columns of data; name, start depth and end depth. Some of the names have either an A or a B at the end of them

    In these locations I want to work how much of the data has overlapped.

    For example if BH01 went from 0.00 to 10.00 and BH01A went from 8.00 to 20.00 then the overlap would be 2.00. However I can't work out in my head how I'd do this using formula!

    Please help my small brain

    Sean
    Attached Files Attached Files
    Last edited by mrsak87; 09-24-2018 at 06:27 AM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: Can I pick your brains on how you would work this out? My brain isn't working

    Hi,
    In D2 array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    PS. Please do edit title thread (go to your first post and select edit) to comply with Rule 1 of https://www.excelforum.com/forum-rul...rum-rules.html
    Last edited by Kaper; 09-24-2018 at 06:03 AM. Reason: Rule 1 mentioned
    Best Regards,

    Kaper

  3. #3
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Can I pick your brains on how you would work this out? My brain isn't working

    Try in "D2"
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    copy paste down.
    Confirmed by press CTRL+SHIFT+ENTER

    End = Sheet1!$C$2:$C$21
    Start = =Sheet1!$B$2:$B$21


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  4. #4
    Forum Contributor
    Join Date
    03-05-2015
    Location
    norwich
    MS-Off Ver
    365
    Posts
    107

    Re: Can I pick your brains on how you would work this out? My brain isn't working

    Thank you Kaper, works! - and I've edited the title of the thread

  5. #5
    Forum Contributor
    Join Date
    03-05-2015
    Location
    norwich
    MS-Off Ver
    365
    Posts
    107

    Re: Can I pick your brains on how you would work this out? My brain isn't working

    avk - I just get "TRUE" in three of the cells, I'm interested in your method though, Do I need to tweak it slightly?

  6. #6
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Working out amount of data overlaps

    If data range overlap with criteria name then shown as "True". (match with first 5 charters)
    Define start / End range, by name manager.

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: Working out amount of data overlaps

    As for my formula - it consists of 3 key elements:

    The first key element is the length of segments common part.

    If we have 2 segments: a b and c d then common part (provided a<b and c<d can be calculated as

    =MIN(b, d)- MAX(a, c)

    if this value is positive - it's common part, if is negative is a distance between end of one segment and start of next one.
    as we are interested only in common part we can take

    =MAX(MIN(b, d)- MAX(a, c), 0)

    one of segments is clear our a and b are respectively B2 and C2, but as for second segment (this is second key element of the formula) we shall take leftmost start of any previous segment belonging to the same type/name

    so c is MIN(IF(G$1:G1=G2,B$1:B1,""))
    and the end of second segment (d) is rightmost part of any previous segment belonging to the same type/name MAX(IF(G$1:G1=G2,C$1:C1,""))

    the above 2 will work only if we force excel to do array calculations - first constructing array if IF(G$1:G1=G2,B$1:B1,"") and then finding it's smallest element (and similarly with column C, but largest one)

    and the final part (3rd key element) - if it is first occurence of given name/type then there is no segments above to be checked, so we cannot have any overlapping

    IF(COUNTIF(G$1:G1,G2)=0,0,

    And that is how the formula was constructed

  8. #8
    Forum Contributor
    Join Date
    03-05-2015
    Location
    norwich
    MS-Off Ver
    365
    Posts
    107

    Re: Working out amount of data overlaps

    Kaper,

    Thanks for taking the time to explain to that me! I appreciate that for future references

+ 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. And/ Or issue....how to formulate a formula...racking my brains :(
    By helloanupam in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-12-2016, 06:43 AM
  2. Working out pick rate, work sheet attached,
    By Presley1 in forum Excel General
    Replies: 0
    Last Post: 08-04-2015, 06:06 AM
  3. Layout: Fresh Brains Needed!
    By dlab85 in forum Access Tables & Databases
    Replies: 1
    Last Post: 02-06-2013, 09:22 AM
  4. Replies: 7
    Last Post: 01-28-2013, 12:20 PM
  5. Replies: 3
    Last Post: 10-01-2012, 04:05 PM
  6. best Formula to caculate a wage threshold
    By agalinauskas in forum Excel General
    Replies: 1
    Last Post: 07-05-2012, 03:19 PM
  7. Regarding MS VBA HELP ( very easy ) my brain just not working
    By zoomer003 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-27-2012, 11:08 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