+ Reply to Thread
Results 1 to 16 of 16

Return Call time for each person less or equal than Break time

  1. #1
    Registered User
    Join Date
    11-28-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    10

    Return Call time for each person less or equal than Break time

    Hi ,

    I am new to macro so need your help. i have 2 sheet i sheet consists of advisor name and break time and other sheet consists of the advisor name and their call timing and need to find the last call call of the advisor before each break.


    Example

    first sheet
    A1 B1
    Advisor Break Time
    Amitav 10:03:00
    Amitav 11:03:26
    amitav 12:32:00
    amitav 13:43:32
    MD 9:00:32
    MD 10:35:32
    MD 12:23:34
    MD 14:27:00
    jackson 11:34:00
    Jackson 14:25:00
    Jackson 15:20:35

    The second sheet
    Advisor Call Time

    Amitav 11:03:26
    amitav 12:32:00
    amitav 13:43:32
    amitav 9:00:32
    amitav 10:35:32
    amitav 12:23:34
    amitav 14:27:00
    amitav 11:34:00
    amitav 14:25:00
    amitav 15:20:35


    I want to find the last call time of amitav before every break and this for all advisor .

    I have a large data so i want to make a loop that will repeat as the advisor name changes.
    Last edited by zbor; 12-15-2012 at 04:25 AM. Reason: Title change

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Hi

    Try this array formula

    =MAX(IF((Sheet2!$A$1:$A$11=Sheet1!A2)*(Sheet2!$B$1:$B$11<=Sheet1!B2),Sheet2!B1:B11))

  3. #3
    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,939

    Re: Hi

    please rename your thread to something more meaningful, that actually describes your problem. lots of contributors will look at a thread title, and if it of interest to them, or falls within their area of expertise, and will only open those threads. also, searching for "help" will not turn up too many results that will benefit you, sorry
    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

  4. #4
    Registered User
    Join Date
    11-28-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re:Help needed urgently and this can be a testing time of all the excel masters

    Hi

    Thanks a lot for the formula but can you do me a small favour is it be possible for you to explain me the formula so that it will be a great help for me and i can use it if i need if afterwards if i have the understanding of the formula .i am attaching a excel sheet for your reference so that it will be easy for you to explain the formula. Thanks in advance


    I hope you got me i will explain you again what i need


    Suppose a advisor has taken a break at 10:30:00 i want to check what was his last call timing before the braek which i can get from the second sheet .I can do that manually if i have only few entries but i have many entries so it is qiute hard to do it manually.
    Attached Files Attached Files

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Hi

    Amitav,

    You need to comply with post 3 and edit the title in post 1.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  6. #6
    Registered User
    Join Date
    11-28-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    10

    Needed urgent help from a excel master to provide and explain a formula

    Hi ,

    I have a data base base which consists of two sheets . In first sheet all the advisors break time are recorded and in the second sheet his all the call record for the day is stored. I want to check whether the advisor has taken any call before his break within a time span of 30 min or i need the time of his last call before the break

    For example

    If a advisor is taking break at 10:30 then i want to check whether he has taken any call from 10:00:00-10:30:00

    The second sheet will give me the advisors all the call details so i can match it manulaay with the braek time but as my data is too large i need a macro or formula which will do the work for me . I have tried amny formulas but i am unable to do anything so at last i have come to the expert as i know nothing is impossible for you all.

    It will of grat help for me if you can explain me the formula so that in future i can use it on my own and it will also make my excel knowledge more sharper .

    I am attaching a sample excel file for your reference.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-28-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Hi

    Hi ,

    I understand you v=can you tell what i exactly i need to do comply means

  8. #8
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Needed urgent help from a excel master to provide and explain a formula

    hi amitav. 1 way is to sort by Names & then by Call time, like i did in Sheet 2 column D:E, and then do up the formula
    Attached Files Attached Files

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Needed urgent help from a excel master to provide and explain a formula

    amitav:
    - don't open duplicated posts (Rule 5 of Forum rules)
    - adopt your title to something meaningfull (Rule 1 of Forum rules)

    Please check rules before continue using Forum

    I'll merge this one :

    http://www.excelforum.com/excel-prog...=1#post3047893
    Last edited by arlu1201; 12-15-2012 at 04:34 AM.

  10. #10
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Return Call time for each person less or equal than Break time

    Also, you got solution in Post#2 from Bob:
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    11-28-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Needed urgent help from a excel master to provide and explain a formula

    Quote Originally Posted by benishiryo View Post
    hi amitav. 1 way is to sort by Names & then by Call time, like i did in Sheet 2 column D:E, and then do up the formula

    I am trying to do the same as you have suggested but i am not getting the required result all my rows where i am putting the formula its showing nothing its blank pleae help me I have provided my data sheet also
    Attached Files Attached Files

  12. #12
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Return Call time for each person less or equal than Break time

    That is beacuse there are no calls before the break time, so nothing to show.

  13. #13
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Return Call time for each person less or equal than Break time

    in my solution, i was referencing to column D & E in Sheet2, and only up to 45 rows. you didnt change that. anyway, it seems like my formula was flawed somehow. here's an amended one to paste in Sheet1 C2 & pasted down:
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    11-28-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Return Call time for each person less or equal than Break time

    Hi,

    Thanks a lot the formula is great and its working now. I have a small request can you please please explain me the formula so that if i get any error in future i can myself correct it . It will also help me to learn something new from a genious. Its a humble request.

  15. #15
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Return Call time for each person less or equal than Break time

    here's the lengthy explanation. let's go through simpler eg before we go to the real case. for eg.
    Sales Commission
    0 1%
    1000 5%
    3000 10%
    1) LOOKUP
    A simple LOOKUP statement will use the lookup_value you indicate & look for an exact match in the lookup_vector. If it doesn't find any, it looks for the closest number lesser than the lookup_value & return the corresponding row in the result_vector. say if we want to give commissions based on the sales figures, then 0 to lesser than 1K will be "1%", 1k to lesser than 3K will be "5%", & 3K or more will be labelled 10%. you can try copying this table into A1:B4 & place a sales number in C1. then in D1:
    =LOOKUP(C1,A2:A4,B2:B4)

    2) Logical Test
    so that's for LOOKUP. secondly, we are just going to do some logical tests. A logical test will return TRUEs & FALSEs. using the above eg again, you can try this in D6:
    =A2:A4>500
    that is to find which which of these cells in A2:A4 is greater than 500. it gives you a VALUE error because there are multiple values. to see them, press F2 on the cell D6 & press F9 to calculate. you should see this:
    ={FALSE;TRUE;TRUE}
    that's saying A2 is not greater than 500 (FALSE), A3 is greater than 500 (TRUE), A4 is greater than 500 (TRUE)

    3) Multiple Logical Tests
    In your situation, you need more than 1 logical test; Names in the range must be equals to xxx, time in the range must be greater than or equals to x timing minus 30 minutes, and time in the range cannot exceed the x timing. Excel actually treats TRUE as 1 & FALSE as 0. so if you were to multiply 2 different logical tests, you would get 1s only when both logical tests are TRUE. using the eg again, let's find which is more than 500 & has a commission more than 7%. so in D11:
    =(A2:A4>500)*(B2:B4>0.07)
    again, VALUE error. but if you press F2 again on the cell & F9 to calculate, you should get:
    {0;0;1}
    what happened was the 1st logical test returns {FALSE;TRUE;TRUE} & the 2nd {FALSE;FALSE;TRUE}. so converting them to 1s & 0s would be
    {0;1;1}*{0;0;1}
    so:
    {0*0;1*0;1*1}
    only the last one would get 1. i placed a table in B16:D19 doing the logical test individually to show you

    4) TIME
    Time are actually decimals in Excel. the number 1 is one full day, so half a day is actually 0.5 (which is equivalent to 12 pm). hence, to do a subtraction of 30 minutes to a time, you have to use the TIME formula or some division to get a decimal. for eg. i placed a time of 12 pm in
    B21. the TIME formula contains 3 parts; Hours, Minutes, Seconds. so if i dont place anything in it, it's actually using 0. i can then use
    =B21-TIME(,30,)
    or;
    =B21-30/60/24
    30 minutes has to be divided by 60 minutes an hour & 24 hours a day. of course, you can simply type the total minutes a day:
    =B21-30/1440

    5) LOOKUP with Logical Tests
    As you have seen with the logical tests, TRUEs return 1 & FALSEs return 0. so if i use 1 divided by all the 1s & 0s, i will get a bunch of DIV errors & 1s. DIV error happens when you take a number to be divided by 0. see D24
    =1/((A2:A4>500)*(B2:B4>0.07))
    calculate & you'll get:
    ={#DIV/0!;#DIV/0!;1}
    so the maximum number i'm ever going to get here is 1. remember what happens what you look up for a number that exceeds the lookup vector (like a sales of $3.5k)? it will return you the last entry. that is why when your data is sorted, it will return you the last timing of person x according to the criteria you state.

    6) IF & ISNA
    the last bit here is just to return a blank when there are no scenarios that meets the criteria. C29 shows a perfect scenario where there the criteria of >500 & >0.07 is met. C30 shows a scenario where >5000 is not met, so it returns NA. C31 shows a scenario where >0.2 is not met, hence NA. so applying the IF & ISNA can help hide the errors in D29:D31. basically:
    =IF(ISNA(FormulaInput),"",FormulaInput)
    so the above is saying if the FormulaInput (our LOOKUP formula) is NA, return blank (""), otherwise return the results of FormulaInput (LOOKUP formula).


    you can see Sheet2 for a minimised version of your data.

    hope that helps
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    11-28-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Return Call time for each person less or equal than Break time

    Hi Friend,


    Thanks thanks thanks a lot i am short of words to thank you you are simply great. Your explanation is really very helpful for me .


    MERRY CHRISMAS have a great chrismas .

    I will always be in touch with you as its a privilage for me to learn excel from a graet and genious person like you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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