+ Reply to Thread
Results 1 to 17 of 17

Max Date if one of a few conditions applies

  1. #1
    Registered User
    Join Date
    12-06-2013
    Location
    Decatur, Alabama
    MS-Off Ver
    Excel 2011 Mac
    Posts
    10

    Max Date if one of a few conditions applies

    I'm trying to find the latest date from a column if certain conditions are met. I have this formula to find the Max date when looking for an account number:
    =MAX(IF('Sheet2'!$Q:$Q=B1,'Sheet2'!$J:$J))
    Here, B1 is the account #, Q is the range searched, and J is the date. Q & J are on a different sheet (Sheet2).

    What I need to do is get the Max date for that account # if the corresponding value in Column G of sheet2 is greater than 0 and also if the corresponding 1st 2 characters in Column L of sheet2 begins with one of the following:
    CK
    CA
    AJ
    CP

    Is this possible? It's a bit beyond me. Thanks ahead of time for any help!

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Max Date if one of a few conditions applies

    Please Login or Register  to view this content.
    You were on the right path, just need to smoosh in more criteria.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    12-06-2013
    Location
    Decatur, Alabama
    MS-Off Ver
    Excel 2011 Mac
    Posts
    10

    Re: Max Date if one of a few conditions applies

    Oh wow. I'm seriously impressed. You, sir, are a flipping genius!! Thank you!!

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Max Date if one of a few conditions applies

    =P Glad I could help out.

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Max Date if one of a few conditions applies

    @daffodil11

    Could the formula be shortened to the following?

    Array enter (Ctrl + Shift + Enter)
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Max Date if one of a few conditions applies

    Holy crap that worked.

    That certainly shortens my considerable use of OR logic with regards to arrays. Thanks Ron!

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Max Date if one of a few conditions applies

    You're welcome!

  8. #8
    Registered User
    Join Date
    12-06-2013
    Location
    Decatur, Alabama
    MS-Off Ver
    Excel 2011 Mac
    Posts
    10

    Re: Max Date if one of a few conditions applies

    First, thank you both for the help. Second, Excel seems to freeze up whenever I use one of these formulas. Of course, there is a lot of data. Sheet 1 can have as many as a couple hundred rows and sheet2 has around 115k rows. Things seem fine until one of the formula is used though. By freeze, I mean that the workbook becomes unresponsive. I don't get the spinning wheel of death and if you open the Force Quit options it does not show Excel as not responding (I'm on a Retina Macbook Pro).

    Any ideas what's happening or how I can work around this?

  9. #9
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Max Date if one of a few conditions applies

    Array formulas are processor intensive.

    More than a few dozen of them in use can begin to noticeably slow response time, and applied against a range of 100,000 rows the recalculation would take at least a minute.

    Perhaps it's time to consider using VBA to perform calculations. It takes just as much time, but produces static results without the volatility of a constantly recalculating formulas. I had to do something similar for calculating the shortest distance from 294k points to 850 others. 294k array formulas can really grind you to a halt.

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Max Date if one of a few conditions applies

    daffodil11 has it right on. You don't say how many columns are filled down to 115K rows but that in itself if it involves calculations can tie up excel just as if it is frozen. I don't know anything about Macs but I suspect that things like memory and free disk space will affect performance just like on PCs.

  11. #11
    Registered User
    Join Date
    12-06-2013
    Location
    Decatur, Alabama
    MS-Off Ver
    Excel 2011 Mac
    Posts
    10

    Re: Max Date if one of a few conditions applies

    Unfortunately, I think that's beyond me. I've never done VBA and am not even sure I understand what it is. By taking as much time, do you mean it takes as much time to setup (i.e. type in) or that the calculations it performs like as long? If the calculations are quicker, that might help.

  12. #12
    Registered User
    Join Date
    12-06-2013
    Location
    Decatur, Alabama
    MS-Off Ver
    Excel 2011 Mac
    Posts
    10

    Re: Max Date if one of a few conditions applies

    Hmm, would it help if I put the excel file on an external USB 3 SSD that's not nearly as full as my boot drive? If all conditions are equal, the external USB 3 SSD transfer speed is about the same as the boot drive. So here, it might be faster b/c it's not nearly as full.

    Also, is there a way to get Excel to use more RAM?

  13. #13
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Max Date if one of a few conditions applies

    Using an external drive could make matters worse. An internal SSD makes a tremendous difference over a standard hard drive but with an external drive, you are at the mercy of the actual USB speeds vs the stated speeds. You have nothing to lose by trying it though.

  14. #14
    Registered User
    Join Date
    12-06-2013
    Location
    Decatur, Alabama
    MS-Off Ver
    Excel 2011 Mac
    Posts
    10

    Re: Max Date if one of a few conditions applies

    Oh thanks, good advice. When I'm not on my day job, I'm an indie filmmaker so I use the drive for video editing. It pretty much maxes out USB 3 speed and is a big hit in that community. I'll give it a try. Can't hurt.

  15. #15
    Registered User
    Join Date
    12-06-2013
    Location
    Decatur, Alabama
    MS-Off Ver
    Excel 2011 Mac
    Posts
    10

    Re: Max Date if one of a few conditions applies

    Oh thanks, good advice. When I'm not on my day job, I'm an indie filmmaker so I use the drive for video editing. It pretty much maxes out USB 3 speed and is a big hit in that community. I'll give it a try. Can't hurt.

  16. #16
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Max Date if one of a few conditions applies

    You could. As far as I'm aware, nearly everything in Excel is driven purely by processor speed. The only exceptions I'm aware of are SQL/database queries which can be affected by network latency and Copy/Paste procedures which are reliant upon RAM.

  17. #17
    Registered User
    Join Date
    12-06-2013
    Location
    Decatur, Alabama
    MS-Off Ver
    Excel 2011 Mac
    Posts
    10

    Re: Max Date if one of a few conditions applies

    Ok, I think it works now. I did a little workaround by making tables of the data on the sheet that requires the array formula so it would calculate everything w/o the need to drag & copy. Then I added the array last so nothing else needed to be done. Looks like it works, yea!!

    As a side note, the reason I'm going to all this trouble is b/c the company that makes & supports our banking software calculates the last payment date for an account as the last date something was done to it. Could be that was when a charge was added to it, which is NOT the same as a payment. But, if you go by there last date then you could get sued in a hurry. To me, this is catastrophic lazy calculation #5 or 6 on their part. I keep wondering how no one else noticed these things. I keep not getting answers.

    Again, thanks for all the help!!

+ 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] Last Save Date Macro that applies to ALL Spreadsheets in a Workbook
    By sillyevi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-11-2014, 01:19 AM
  2. do until loop with if statement that applies on different columns (vba)
    By ddesantis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-31-2014, 06:28 PM
  3. Conditional Formatting that applies a THEME??
    By RiTz21 in forum Excel General
    Replies: 0
    Last Post: 07-21-2012, 03:29 PM
  4. formulae that applies to all sheets on opening
    By jamiepullen in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-11-2008, 08:50 AM
  5. Index text so that the formatting still applies.
    By RichardDC in forum Excel General
    Replies: 0
    Last Post: 01-20-2005, 12:19 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