+ Reply to Thread
Results 1 to 6 of 6

Sum certain cells in certain columns on multiple worksheets

  1. #1
    Registered User
    Join Date
    07-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2011
    Posts
    25

    Sum certain cells in certain columns on multiple worksheets

    I'm trying to write a formula in Sheet1 that sums some cells in a particular column on all other worksheets. The particular column on the other worksheets will not always have the same column reference, but the cell in row 1 of that column will always have the text string Hours. The particular cells in the column I want to sum also won't always have the same row references, but I can identify them when an adjacent cell contains the text string Project.

    So I'm basically using a combination of the SUMPRODUCT and SUMIF functions.

    I've got this formula working fine:

    =SUMPRODUCT(SUMIF(INDIRECT("'SomeSheets'!$A:$A"),"Project",INDIRECT("'SomeSheets'!B:B")))

    but it only checks the B:B column, which isn't always the column I need.

    So I need to replace the B:B reference with a function that checks all the columns between B:Z and only sums the column whose cell in row 1 contains Hours.

    I've tried swapping the B:B out for:

    &(INDEX('SomeSheets'!B:Z,0,MATCH("Hours",'SomeSheets'!B1:Z1,0))

    but it breaks.

    I've also toyed with COLUMN and VLOOKUP but no dice.

    Any ideas would be much appreciated!

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Sum certain cells in certain columns on multiple worksheets

    Try

    =SUMPRODUCT(SUMIF(INDIRECT("'SomeSheets'!$A1:$A1000"),"Project",OFFSET(INDIRECT("'SomeSheets'!A1"),,MATCH("Hours",INDIRECT("'SomeSheets'!A1:Z1"),0)-1,1000,1)))

    Change range to suit your likely maximum

  3. #3
    Registered User
    Join Date
    07-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2011
    Posts
    25

    Re: Sum certain cells in certain columns on multiple worksheets

    Thanks for your input. I've given it a go, but I'm not getting a good result. The OFFSET function in there is giving me the contents of the cells I want to check, not the cell references.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Sum certain cells in certain columns on multiple worksheets

    Please post a sample file showing expected results.

    To upload a file, click "Go Advanced" the scroll down to "Manage Attachments"


    You might consider putting the "Project/hours" data in the same cell i.e SUMIF on each sheet and then just use SUM

    =SUM(Firstsheet:Lastsheet,XX)

    XX is cell containing result in every sheet.
    Last edited by JohnTopley; 07-17-2016 at 11:17 AM.

  5. #5
    Registered User
    Join Date
    07-11-2016
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2011
    Posts
    25

    Re: Sum certain cells in certain columns on multiple worksheets

    Thanks for the suggestion John, I've actually managed to fix it. The MATCH command wasn't able to look across multiple worksheets. So I've split the function into separate cells - one works out which column I need to look at on each worksheet, the other does the adding.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Sum certain cells in certain columns on multiple worksheets

    Glad it's fixed.

+ 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. Excel 2007 : VBA Sorting Columns in Multiple Worksheets
    By Michael Chandrapal in forum Excel General
    Replies: 8
    Last Post: 10-06-2018, 06:54 PM
  2. Array Formula Indexing multiple columns/multiple worksheets
    By cwhite86 in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 11-19-2015, 02:19 PM
  3. [SOLVED] AverageIF using multiple criteria in different columns in multiple worksheets
    By trubertiam in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-03-2014, 09:28 PM
  4. Copy Multiple Worksheets into new columns
    By Edwardanson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 09:11 PM
  5. extracting 2 columns from multiple worksheets
    By sirgeo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-28-2011, 04:31 PM
  6. Filter for date range across multiple columns and multiple worksheets
    By Pugface in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-02-2011, 05:30 AM
  7. [SOLVED] linking multiple columns onto multiple worksheets
    By talderman in forum Excel General
    Replies: 3
    Last Post: 08-22-2006, 09:05 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