+ Reply to Thread
Results 1 to 23 of 23

Formula for Last Time Contacted

  1. #1
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Formula for Last Time Contacted

    I have a sheet with a log of calls. I have created a test workbook (attached; expected rows for "last contact" highlighted on CallLog sheet) to assist in a resolution. On the CallLog sheet, there are four columns: Time; Date; Number; Direction. So each time a call is made/received, it is logged with the phone number and a time stamp. There is a second sheet, Contact (Name; Number; Last Contact), which needs, for each phone number listed, the last time it was contacted (regardless if inbound or outbound).

    The formula I found somewhere online and have probably butchered, works great for the first line item in the Log, but the second (and all the rest) contact does not. It seems to just bring in the second line regardless if the number matches or not.
    This is the formula I currently have for the Last Contact:

    =TEXT(INDEX(CallLog!$B:$B,SUMPRODUCT(MAX(CallLog!$C:$C=$B2)*ROW(CallLog!$C:$C))),"MM/DD/YYYY")&" "&TEXT(INDEX(CallLog!$A:$A,SUMPRODUCT(MAX(CallLog!$C:$C=$B2)*ROW(CallLog!$C:$C))),"hh:mm am/pm")

    Any help/suggestions would be greatly appreciated!!
    Attached Files Attached Files

  2. #2
    Forum Contributor jayajaya_4's Avatar
    Join Date
    05-09-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    259

    Re: Formula for Last Time Contacted

    hello pls send the output u needed??


    Regards
    Last edited by jayajaya_4; 07-28-2015 at 09:45 AM.

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Formula for Last Time Contacted

    Using your posted workbook...Try something like this
    Please Login or Register  to view this content.
    Note 1: It's better to avoid calculating on an entire column.

    Note 2: I'd convert the CallLog data to an Excel table (which would automatically adapt to the available data)
    ...Then the formulas could be constructed using structured references

    Exampe: Converting the CallLog to a table named tblCallLog
    Please Login or Register  to view this content.
    Copy either formula down as far as you need.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    Ron, thank you very much! Yes, that did help tremendously. I am not sure about the conversion to a table though. I did it, and it worked great, but I insert new records on a daily basis (to the top of the sheet), and it wouldn't let me do that once it was changed to a table. Seems like a minor thing, but it's kind of a big deal. I'll play around with it some more and see if it is just me causing the issue or not.

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Formula for Last Time Contacted

    It shouldn't be a problem to insert rows UNDER the heading row.
    Alternatively, you could put the rows under the table and sort the table
    (I usually paste_special.values to avoid overwriting the table formatting)

  6. #6
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    Is there a limitation on size or number of rows or something with the INDEX function? I seem to be experiencing the issue again when I attempted to put it in my "real" spreadsheet. There are 13065 records in this sheet and the first contact works without a problem, but the second is doing the same thing as before. I have gone through and removed records until the function works again (at 3266 records remaining of the 13065), but that doesn't give me valid results as some of the customers may have had their last contact in those "missing" 10K records.

  7. #7
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    And the insert cells on the table as I mentioned before is still not working for me. When I do it, instead of the normal "insert copied cells" option followed by "shift cells down", I receive an error stating "This operation is not allowed. The operation is attempting to shift cells in a table on your worksheet."

    I have tried to insert these records directly below my header row as well as several rows down. Same thing in either case.

    I was able to successfully add them to the bottom of the records and perform a sort, however, trying to easily get to the bottom of my data is a real pain. Normally I type CTRL-end, and it takes me to the bottom right cell of my data. However, with the table, it takes me to the very bottom of the sheet (row 1048576). So I had to page down for several minutes to get to the spot where I could paste my data. I would much prefer to be able to insert the copied cells at the top. Suggestions? Am I being dense on this one? Missing something completely obvious?
    Thanks!

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Formula for Last Time Contacted

    1. There is no limit on the INDEX function. Did you include all rows in the formula? Red numbers need updating

    C2: =MAX(INDEX((CallLog!$C$2:$C$1000=Contact!B2)*(CallLog!$B$2:$B$1000+CallLog!$A$2:$A$1000),0))

    2. Right click on any cell within your table's first row of data > Insert> "Table Rows above"
    Select multiple rows first to insert multiple rows.

    Hope that helped.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  9. #9
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    1. I actually went with the table option that Ron provided:
    C2: =MAX(INDEX((tblCallLog[Number]=Contact!B2)*(tblCallLog[Date]+tblCallLog[Time]),0))

    I was going to do the first since that was the direction I was going originally but he said it was better not to calculate on the entire column.

    2. I selected a cell from my first row of actual data (not the header) and the insert "Table Rows above" is grayed out, only "Table Columns to the left" is available. I then tried selecting the entire row, same options. I then selected, rather than the entire row (Row 2), only the cells containing data (A2:H2) and tried it again, same results. No option to insert rows above.

  10. #10
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    I have figured out the insert rows problem, but not fully. If I select Columns A:H and insert a table, it works, but I can't insert any tables rows. It seems to create a table with rows all the way down to the very last available row, even if there is no data. However, if I go to the bottom of my existing data and then select everything back up to the top and then insert a table, I can insert rows to the top. However, I don't have the option to insert my copied cells. I can only insert blank rows and then paste. This option is fine for a few records, but there are days I have hundreds.........would prefer to have the option to "insert copied cells" > "Shift cells down" like I did before. Am I missing something?

    Though, the bigger problem is still the index problem. If there are more than 3266 records in the table, I can't get a "last contacted" date/time for any individuals.
    Last edited by kalffiend; 07-30-2015 at 07:50 AM.

  11. #11
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    For example (on the index problem). I changed things to use the other formula (without the table).

    This works, returning the correct results (took some messing around with the values to find the last one [3361] it would return correct results, 3362 does not return):
    =TEXT(MAX(INDEX((Copy5!$C$2:$C$3361=Counts!B2)*(Copy5!$F$2:$F$3361+Copy5!$G$2:$G$3361),0)),"MM/DD/YYYY hh:mm am/pm")

    This does not work, returning a #VALUE error (anything above row 3362 does this):
    =TEXT(MAX(INDEX((Copy5!$C$2:$C$3362=Counts!B2)*(Copy5!$F$2:$F$3362+Copy5!$G$2:$G$3362),0)),"MM/DD/YYYY hh:mm am/pm")

  12. #12
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Formula for Last Time Contacted

    Ahhh, okay, first the row problem.
    You cannot insert rows if your table already takes up the maximum rows of the spreadsheet.
    Just select your data when creating a table. One of the huge advantages to tables is that when you start typing on the next row under your table, Excel automatically includes that in your table (just don't skip rows) and sets up formats and even formulas appropriately.

    I took your first file, converted the call log into a table and applied Ron's formula. Maybe that will help to figure out where you are going wrong.
    Attached Files Attached Files

  13. #13
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Formula for Last Time Contacted

    A table should only include its relevant data. Creating an Exce Table that references entire columns defeats the purpose of using a table.
    Resize the table to only include the current data.

  14. #14
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    Yes, I have changed the table. However, the index issue does not get resolved by that change, only the row inserts (but still not the insert copied cells, only inserting blank rows). Any ideas on the index issue? If you want/need, I'll try to create a new sheet with thousands and thousands of test records so you can see what I am experiencing....?

  15. #15
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Formula for Last Time Contacted

    I'd love to see a table where you're experiencing this problem. Make it as small as possible.

  16. #16
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Formula for Last Time Contacted

    Thanks, CB. I can't post files from my work location...(I'll get smacked with a newspaper over the snout if I try)

  17. #17
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    Alright, it'll take me a few minutes to generate enough records [can't be less than 3362 ], but I'll post it shortly.

  18. #18
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    Alrighty, I have created a new file with 3500 records. I made it resemble my "real" data file as much as possible (additional columns). There are now three sheets. One with a table, one without a table, and the last contact sheet. The last contact sheet now has three "last contact" columns. One for the table (using the table formula), and two for the sheet without the table (using the "not table" formula). The first of these references cells 2:3363 and works. The second references cells 2:3364 and does not work. Both the table "last contact" and the second "no table last contact" columns return a #VALUE error.
    Attached Files Attached Files

  19. #19
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Formula for Last Time Contacted

    There's a typo in your CallLogTable sheet.
    A3364
    IS..............Jul 6, 05;04 PM
    Should be... Jul 6, 05:04 PM

    Better?

  20. #20
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    Pardon this, but o...........m.............g. What a dumb, dumb, dumb, dumb thing. I seriously can't even believe that was in there!

    I found that same semi-colon in the "real" data, fixed it, and yes, that made it all better. Thank you so much for all the help!!!!!!!!!!

  21. #21
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Formula for Last Time Contacted

    Glad you got something you can use!

  22. #22
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Formula for Last Time Contacted

    Ron's find fixed it for me. I suggest on the Sort Dropdown menus for "Date" and "Time" columns, you check the bottom of the list for errors (see attachment).
    I also used this formula for extracting the time (format the cells in C to time format)

    =TRIM(MID([@DateTime], SEARCH(",",[@DateTime])+1,10))+0

    It wouldn't have fixed your problem but it sure is simplier.
    Attached Images Attached Images

  23. #23
    Registered User
    Join Date
    09-19-2012
    Location
    Texas
    MS-Off Ver
    Excel 2013
    Posts
    15

    Re: Formula for Last Time Contacted

    I like simple! Thanks, I'll give it a go!

+ 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: 3
    Last Post: 12-19-2013, 06:49 AM
  2. Replies: 5
    Last Post: 04-18-2013, 11:31 AM
  3. Replies: 2
    Last Post: 01-31-2013, 02:01 PM
  4. Replies: 0
    Last Post: 01-31-2013, 01:42 PM
  5. Formatting a total time entry and building a cumulative time formula.
    By TMc10 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-16-2012, 10:26 PM
  6. Formula for Calculating Paid Time Off for fiscal anniversary date real time
    By 168rockwood in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-07-2012, 04:15 PM
  7. Replies: 2
    Last Post: 04-27-2011, 08:21 AM
  8. [SOLVED] template or formula for start time -finish time -total hours ple
    By cc in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-27-2006, 01:10 PM

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