+ Reply to Thread
Results 1 to 6 of 6

Sum of values into merged cells

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-06-2021
    Location
    Tripoli
    MS-Off Ver
    Still using 2007 in 2023
    Posts
    291

    Red face Sum of values into merged cells

    Hey guys,
    I hope you are all fine.
    I have a set of numbers in column A, through which i want to calculate their sums with respect to each merged cell adjacent to the numbers.
    My excel file make it so clear.
    Thanks for helping me with this.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: Sum of values into merged cells

    What is the criteria by which you group the values in column A?
    Avoid using merged cells as much as possible. If there is a rule according to which the grouping is done, you can use Pivot Table
    Diana Tanase


    If the solutions offered helped you to solve your problem, then mark the thread as SOLVED (thread tools in the top menu) and you can click on * to add reputation to those who helped you, as a way to say thank you !

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,424

    Re: Sum of values into merged cells

    As tanasedn has already said try to avoid merged cells. They are the devil's spawn. This solution in the attached workbook is a good demonstration of that.

    In column D is a helper column. The start of each range is marked with "zzz". Notice the added row in that column with the "zzz". This forces the end of the last range by extending the range 'Given'. In column E is a helper that calculates the row number of each "zzz". If memory serves me you will need to array enter this formula in E4 and fill down.

    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.

    It's formula is
    Formula: copy to clipboard
    =IFERROR(SMALL(IF(N($B$4:$B$30)*($D$4:$D$30="zzz"),ROW($B$4:$B$30)-MIN(ROW($B$4:$B$30))+1),ROWS(E$4:E4)),"")
    and I have named it Indices in Name Manager.

    In C4 this formula returns the totals. I don't think you will have to array enter it even in Excel 2007. If I am wrong you'll have to fiddle with it a bit. Merged cells hate array formulas.
    Formula: copy to clipboard
    =IF(D4="zzz",SUM(INDEX(B$4:B$30,SMALL(Indices,COUNTIF(D$4:D4,"zzz"))):INDEX(B$4:B$30,SMALL(Indices,COUNTIF(D$4:D4,"zzz")+1)-1)),"")
    Attached Files Attached Files
    Dave

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,424

    Re: Sum of values into merged cells

    Please let us know how this worked out for you. It's been a while since I've used 2007. I didn't check it out on my other machine. So I'm curious if this worked. (I keep "double-o-seven" in another location. LOL)

    In the meantime thanks for the added rep and marking your thread Solved.

  5. #5
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,541

    Re: Sum of values into merged cells

    First clear the data in this area C4:C27

    Then Click the left mouse button to select the ranges area C4:C27
    Then Keyboard CTRL+G/Special/Blanks/Key in this formula =SUM(B4:B$29)-SUM(C5:C$29) in Formula Bar then CTRL+ENTER

    Please watch this animation teaching file FILE name as SV4.gif
    After the file is downloaded and decompressed, you can use the left mouse button to click twice to watch the teaching file (video) or open it with explorer.
    Attached Files Attached Files
    Last edited by wk9128; 12-02-2022 at 09:38 PM.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2405
    Posts
    13,424

    Re: Sum of values into merged cells

    @ wk9128, very good! So simple. Thanks for sharing.

+ 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] Transpose merged cells values
    By KingTamo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2019, 04:48 AM
  2. help with macro Copy-paste values (merged cells to single cells)
    By StoyC in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-14-2018, 09:58 AM
  3. [SOLVED] Paste Values (Grouped Cells and Merged Cells)
    By scruz9 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-17-2016, 10:13 PM
  4. Replies: 0
    Last Post: 11-25-2014, 07:08 AM
  5. Using values from merged cells (VBA)
    By chakal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2014, 05:12 AM
  6. Replies: 1
    Last Post: 06-28-2012, 11:53 AM
  7. Excel 2007 : Values for merged cells
    By carlscott in forum Excel General
    Replies: 2
    Last Post: 09-09-2011, 06:01 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