+ Reply to Thread
Results 1 to 10 of 10

Sorting with Array formula

  1. #1
    Registered User
    Join Date
    09-24-2014
    Location
    Pinjarra, Australia
    MS-Off Ver
    2011
    Posts
    45

    Sorting with Array formula

    I have the following array formula in my spreadsheet, however when I sort the data the reference 'Portable Register'!C7 acts like an "absolute" reference even though there is no $ $ in it, and ends upreferring to the wrong row.

    {=MAX(IF('Completed Runs'!$D$4:$D$741='Portables Register'!C7,'Completed Runs'!$G$4:$G$740))}

    Is there a trick to sorting array formulas?

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Sorting with Array formula

    If you post a workbook with some sample data it will be much easier to help you.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Sorting with Array formula

    If you are sorting, you can use a LARGE/SMALL function instead of a MAX function

    Example of it's use would be;

    =LARGE(($A$1:$A$10=10)*ROW($1:$10),ROWS($A$1:A1))

    Placed in cell B1 and dragged down, it will return which rows in A1:A10 have the value of 10. It will have the largest row on top, and descent as you drag it down.
    The opposite can be achieved using SMALL instead of LARGE, you will have to eliminate the zeros if you go for SMALL
    =SMALL(IFERROR((1/($A$1:$A$10=10)*ROW($1:$10)),""),ROWS($A$1:A1))

    Not sure if this helps, but it's the best I can do without a sample file!
    Last edited by Speshul; 09-25-2014 at 12:17 PM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  4. #4
    Registered User
    Join Date
    09-24-2014
    Location
    Pinjarra, Australia
    MS-Off Ver
    2011
    Posts
    45

    Re: Sorting with Array formula

    The spreadsheet "Portables Register" is designed to record the service of portables. The formula looks at a street address in column B, finds that same address listed in the "completed runs" sheet and pulls the last day it was serviced.

    Every time a portable is serviced it is added to the "completed runs" register, hence it is listed multiple times with difference service dates, so to pull the LAST, or MAX service date for a specific address I needed to use an array formula, using the little { } thingies.

    When I sort the "Portables Register" the reference cell doesn't move with that row. Example the formula for row C27 will be looking at C347?

    Are you confused yet?

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Sorting with Array formula

    I am. Where are the spreadsheets?

  6. #6
    Registered User
    Join Date
    09-24-2014
    Location
    Pinjarra, Australia
    MS-Off Ver
    2011
    Posts
    45

    Re: Sorting with Array formula

    Sorry, new to this forum. How do I upload a workbook?

  7. #7
    Registered User
    Join Date
    09-24-2014
    Location
    Pinjarra, Australia
    MS-Off Ver
    2011
    Posts
    45

    Re: Sorting with Array formula

    Think I got it. Here it is
    Attached Files Attached Files

  8. #8
    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,946

    Re: Sorting with Array formula

    Your formula seems to be working fine. There are no matches for the C7:C27
    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

  9. #9
    Registered User
    Join Date
    09-24-2014
    Location
    Pinjarra, Australia
    MS-Off Ver
    2011
    Posts
    45

    Re: Sorting with Array formula

    OK. The formula initiall was:

    {=MAX(IF('Completed Runs'!$D$4:$D$741='Portables Register'!C7,'Completed Runs'!$G$4:$G$740))}

    I changed the 'Portables Register'!C7 to and just =C7

    {=MAX(IF('Completed Runs'!$D$4:$D$741=C7,'Completed Runs'!$G$4:$G$740))}

    And it has no problem sorting.

    Thanks for everyones help.

  10. #10
    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,946

    Re: Sorting with Array formula

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. Having an issue with an Array Formula sorting lists
    By Pershing in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-24-2014, 09:31 AM
  2. Sorting table with array formula
    By WoodyFan in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-17-2014, 08:28 AM
  3. [SOLVED] Sorting results from an array formula
    By dancing-shadow in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2012, 06:17 PM
  4. array formula, sorting time and day of the week.
    By xatomicx in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-12-2012, 12:11 PM
  5. Sorting a CSE Array Formula
    By tbone90s in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-22-2009, 05:22 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