+ Reply to Thread
Results 1 to 5 of 5

Sort macro conflicting with formula to produce incorrect results

  1. #1
    Registered User
    Join Date
    01-17-2014
    Location
    England
    MS-Off Ver
    Excel 2003 + 2010
    Posts
    11

    Sort macro conflicting with formula to produce incorrect results

    Hi All,

    I have an issue with the current spreadsheet im working on.

    there is a sheet for each month of the year and a totals page.

    I currently have a macro that sorts each sheet in my document by column A.

    column A on sheet 1 "Jan" contains a list of names. as these names are required across all other sheets the formula "=Jan!A5" to "=Jan!A165" is applied to Column A on all following Sheets.

    When the sort macro is run the first page sorts correctly but due to the formula "=Jan!A5" all following pages are sorted incorrectly as the position of the names is changed when the sort is complete on the first sheet.

    I am unsure on how to resolve this, by removing the formula and manually typing or copying the name across to the rest of the sheets the macro works perfectly but this is not ideal from a user perspective.

    any help fixing this issue would be greatly appreciated.

    Employee Absence 2015 Example 101.xlsm

    Much love

    Turtlesrun

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Sort macro conflicting with formula to produce incorrect results

    Pretty sheet BUT ...

    Creating multiple sheets and then trying to link them in this way is always a Royal PitA and best avoided.

    I'm afraid I can't give you a solution as I probably wouldn't start from this position. IMO you would be best redesigning the workbook/worksheets. You're using Excel 2010 so you have 16384 columns available to you. My approach would be to have column A as the employee name and then have 355/366 columns for the dates of the year from 1 January through to December 31, perhaps with a blank column between each month. You could use the blank column to group the days of each month. This would allow you to have the current month visible for input and/or printing. You could, perhaps, have a macro to select and print a specific month, hiding columns not required.

    You could then have the month totals on a separate worksheet with a set of columns per individual with the annual totals at the end.

    In this way, you would only have two sheets and it would be simpler to insert rows and align the data. On the Totals sheet, instead of using a simple =Jan!A5, you would be better having a column which uses MATCH to identify the row for each individual and then using that in SUMIFS/INDEX formula ... not worked that out in my head but doable.

    Hope this helps ... or, at least, provides food for thought.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Sort macro conflicting with formula to produce incorrect results

    Thanks for the rep.

  4. #4
    Registered User
    Join Date
    01-17-2014
    Location
    England
    MS-Off Ver
    Excel 2003 + 2010
    Posts
    11

    Re: Sort macro conflicting with formula to produce incorrect results

    yeah, I started to realise linking multiple sheets probably wasn’t the brightest idea as this wasn’t the first issue its thrown up so far. your suggestions have been very helpful and I think as suggested I should re-evaluate the design then make some changes.

    Thanks

    Turtlesrun

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Sort macro conflicting with formula to produce incorrect results

    You're welcome. Thanks for the feedback.

+ 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] Forumula Results Incorrect when data missing. Wanting to hide the incorrect formula.
    By firemedic6265 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-05-2014, 05:01 PM
  2. Slightly incorrect formula results
    By ianpwilliams in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-06-2013, 05:04 PM
  3. [SOLVED] Double-click macro to produce different results based on different cell ranges
    By Hobsons in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-06-2013, 07:28 AM
  4. Conflicting formatting results
    By jacob@thepenpoint in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-25-2012, 04:52 PM
  5. Macro to produce multiple 'Data sort' findings
    By rushdenx1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-22-2010, 09:24 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