+ Reply to Thread
Results 1 to 7 of 7

Sorting help needed

  1. #1
    Forum Contributor
    Join Date
    10-11-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    230

    Sorting help needed

    I need help with the attached file. If you sort worksheet Docs first by col A and then by col D, you'll see the formulas do not reference the proper cells. How do I get the formulas to still work properly when the rows are sorted?
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-19-2014
    Location
    India
    MS-Off Ver
    Excel & VBA - 2007 & 2010
    Posts
    60

    Re: Sorting help needed

    Hi,

    First of all, i am not sure why you have added somany blank columns into it. secondly why you have added blank rows after header.

    I have sorted it, i didnt find any trouble in the formula. might be you are selecting the header for the sorting.

    if you want to sort such kind of data which has blank rows after header, then simply select the data and then sort it.

    i have sorted the attached sheet, let me know if you need anything else.

    Thanks!
    Moinuddin Shaikh

    If you like my Response:
    1. Show appreciation to those who have helped you by clicking below their posts.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    Appreciate someone towards their career path is better than saying Thanks!
    -Moin
    Attached Files Attached Files

  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,944

    Re: Sorting help needed

    Which formulas are nor working for you? (and in G, why are some cells formulas and others text?)
    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
    Forum Contributor
    Join Date
    10-11-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    230

    Re: Sorting help needed

    The blank columns are because there is data that does not have anything to do with the sorting issue. I deleted the data for the purspose of sending this file.

    When sorting the data, only the data is selected - no headers.

    The file that was returned shows that the data was sorted and also shows where the formulas are not working.
    The formula in Q32 reason as follows: =IF(OR(A32="",M32=""),"",IF(K32=List!$D$3,SUMPRODUCT((Code=Docs!M33)*(List!$H$1:$O$1=Docs!T33)*(List!$H$3:$O$16)),"")).

    The formula in the non sorted file for that same cell reads: =IF(OR(A32="",M32=""),"",IF(K32=List!$D$3,SUMPRODUCT((Code=Docs!M32)*(List!$H$1:$O$1=Docs!T32)*(List!$H$3:$O$16)),""))

    The formula in the sorted file references M33 and T33 within the sumproduct section. It should have stayed referencing M32 and T32. The easy way to see the sorted file is not working is because this cell is red in the sorted file.

    The reason Col G has some cells with a formula and some without is because those without show manually entered text when the formula could not find a match.

    I hope that answers all the questions to direct someone to finding a solution for me. Thank you all for looking at this.

  5. #5
    Forum Contributor
    Join Date
    10-11-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    230

    Re: Sorting help needed

    Was anyone able to figure out why sorting messes up my formulas? I really could use a solution to this. Thanks.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,247

    Re: Sorting help needed

    Are you selecting just columns A and D when you sort, or the whole table?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  7. #7
    Forum Contributor
    Join Date
    10-11-2013
    Location
    California
    MS-Off Ver
    Excel 2010
    Posts
    230

    Re: Sorting help needed

    I am selecting just the data, no headers, not entire rows or columns, just the data in cells A5-X320 or whichever row the last data entered is.

+ 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. Complex Filter/Sorting Help Needed (VBA knowledge needed)
    By dfxryanjr in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-03-2013, 01:39 PM
  2. Sorting a column by age, formula help needed...
    By amster in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-26-2013, 03:59 PM
  3. [SOLVED] VBA sorting by multiple criteria help needed
    By motorhead9999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-14-2012, 07:24 PM
  4. Sorting algorithm doesn't sort as needed
    By rinser in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-04-2009, 04:46 AM
  5. Sorting help needed!
    By BrettOlbrys in forum Excel General
    Replies: 7
    Last Post: 12-30-2005, 08:00 AM

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