+ Reply to Thread
Results 1 to 18 of 18

Formula help needed to extract cell value based on max if array.

  1. #1
    Registered User
    Join Date
    07-09-2015
    Location
    Scotland
    MS-Off Ver
    office 2010
    Posts
    9

    Formula help needed to extract cell value based on max if array.

    Hi All, I hope you may be able to help me.

    I have a spreadsheet with 122 rows. I have used the date function to convert 3 column cells to a date which I can manipulate. I have a requirement whereby I need to extract a cell value and copy this value to another cell location based on certain criteria. There are multiple rows which have the same username but have different dates. I have used the min and max function with arrays to extract the most recent and oldest dates and assign them to their appropriate columns using the formula below:

    This has worked well. B2-B122 references the username column (which has more than one instance) and F2-F122 references the date column.

    =MIN(IF(B$2:$B$122=B2,F$2:$F$122))
    =MAX(IF(B$2:$B$122=B2,F$2:$F$122))

    I’d now like to extract specific cell values - L2-L122 for each of the max date rows – not the min date rows. I’ve tried the following but this does not work.
    =INDEX(L2:L122,MAX(IF(B$2:$B$122=B2,F$2:$F$122)),1,0)

    If possible I'd also like to discard any records which only have one username listed, in other word only one instance in the B column. A string could perhaps be inserted into the new column which will contain the indexed values which says only 1 record or similar.

    Any help would be greatly appreciated. Thanks in advance.
    Wilbur

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,647

    Re: Formula help needed to extract cell value based on max if array.

    Hi there... and welcome to the Excel Forum. Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    07-09-2015
    Location
    Scotland
    MS-Off Ver
    office 2010
    Posts
    9

    Re: Formula help needed to extract cell value based on max if array.

    Hi, thanks for the quick reply. I have attached a before and after sheet and I'd appreciate any help you can provide.

    Cheers Wilbur
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,647

    Re: Formula help needed to extract cell value based on max if array.

    Here you go. I think this is what you were after...
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-09-2015
    Location
    Scotland
    MS-Off Ver
    office 2010
    Posts
    9

    Re: Formula help needed to extract cell value based on max if array.

    Hi, I'll take a good look over this. It looks excellent so far. I'll get back to you and let you know how it goes. Thanks again.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,647

    Re: Formula help needed to extract cell value based on max if array.

    OK. I'll hear from you in due course.

  7. #7
    Registered User
    Join Date
    07-09-2015
    Location
    Scotland
    MS-Off Ver
    office 2010
    Posts
    9

    Re: Formula help needed to extract cell value based on max if array.

    Hi, that was most helpful and I really appreciate your quick response. The date is being converted and extracted and the array statement is being used in conjunction with the IF statement to select the min and max dates for a particular user id. I need to index specific cells only for the row that the most recent date applies to. In the example that you kindly sent to me there is a 3 instead of a 7 for user 4056. The celltoindex applies to the specific user row with the most recent date. Thanks again Glenn for your help.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,647

    Re: Formula help needed to extract cell value based on max if array.

    ????? No there isn't. It's a 7!!! The way I set this up was to return the nth value of the celltoidex column= to the number of occurrences of the ID. Please check the attachment, above, again...

  9. #9
    Registered User
    Join Date
    07-09-2015
    Location
    Scotland
    MS-Off Ver
    office 2010
    Posts
    9

    Re: Formula help needed to extract cell value based on max if array.

    My apologies that should have been a 3. A 3 should be there as it applies to the row with the most recent date. I need the cell contents of the celltoindex only for the row relating to the max formula. Sorry again for the confusion.

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,647

    Re: Formula help needed to extract cell value based on max if array.

    OK. I returned a 7 'cos that was what you had asked for in your "after" sheet, and I was able to see a logical reason for doing so. I'm "off" now (Sat nite and all that); but I'll fix it before you get to your PC in the morning!!

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,647

    Re: Formula help needed to extract cell value based on max if array.

    Is this it??
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    07-09-2015
    Location
    Scotland
    MS-Off Ver
    office 2010
    Posts
    9

    Re: Formula help needed to extract cell value based on max if array.

    Brilliant..that works a treat. Many thanks. Do you know how I'd be able to hide the "one entry" rows and also the rows where a blank is present - just to make the data easier to read? Thank you Glenn for your help.

  13. #13
    Registered User
    Join Date
    07-09-2015
    Location
    Scotland
    MS-Off Ver
    office 2010
    Posts
    9

    Re: Formula help needed to extract cell value based on max if array.

    Thanks for your help thus far Glenn.

    Can anyone possibly help me with presenting the Indexed cell value on the spreadsheet in another location. Currently it sits in the same row as the most recent date but I'd like it to be placed in the same row as the oldest or first date for that specific user. For example I'd like column c row 9 value to be moved to row 5 and column c row 3 to be moved to row 2. Many thanks for your help.

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,647

    Re: Formula help needed to extract cell value based on max if array.

    I haven't been here much for the last few days. You now have two "outstanding" requests. Which (or both) would you like to see attended to. It might help if you were to post your desired "After" results as they have changed a bit.

  15. #15
    Registered User
    Join Date
    07-09-2015
    Location
    Scotland
    MS-Off Ver
    office 2010
    Posts
    9

    Re: Formula help needed to extract cell value based on max if array.

    Okay, I have attached a before and after. I need the indexed cell for the most recent date listed in the first date row. I hope this makes sense. Thanks again.
    Attached Files Attached Files

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,647

    Re: Formula help needed to extract cell value based on max if array.

    Maybe not the prettiest, but it does what you wanted...
    =IF(COUNTIF($B$2:$B$10,B2)>1,IF(COUNTIF($B$2:B2,B2)=1,LOOKUP(2,1/($B$2:$B$10=B2),$L$2:$L$10),""),"One Entry Only")
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    07-09-2015
    Location
    Scotland
    MS-Off Ver
    office 2010
    Posts
    9

    Re: Formula help needed to extract cell value based on max if array.

    Great, many thanks again for your help. Much appreciated. It is very reassuring that help is available from Excel wizards like yourself.

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,647

    Re: Formula help needed to extract cell value based on max if array.

    Glad to have helped! If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. It'd also be appreciated if you were to click the add Reputation button at the foot of any of the posts of those who helped you reach a solution.

+ 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: 6
    Last Post: 01-12-2015, 12:36 PM
  2. [SOLVED] Formula needed to update list based on a cell ref
    By WimpieOosthuizen in forum Excel General
    Replies: 3
    Last Post: 02-06-2014, 01:36 PM
  3. Formula needed to update list based on a cell ref
    By WimpieOosthuizen in forum Excel General
    Replies: 2
    Last Post: 02-06-2014, 10:24 AM
  4. [SOLVED] Help needed with if( formula giving a value in one cell based on two other cells.
    By dancor31 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2013, 08:32 AM
  5. Replies: 7
    Last Post: 04-16-2009, 01:03 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