+ Reply to Thread
Results 1 to 15 of 15

Excel 2007 : Formula to replace a pivot table

  1. #1
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Formula to replace a pivot table

    Subtotal without pivot.xlsx

    Anyone able to enter a formula in the red cell?? I'm guessing it needs to be some sort of Subtotal Vlookup amalgamation

    Need to be able to enter any relevant data in the orange cells and the red cell update accordingly.

    Thanks

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Formula to replace a pivot table

    Use

    =SUMPRODUCT((Data!$C$2:$N$2=$B$1)*(Data!$B$3:$B$9=$B$3)*(Data!$C$3:$N$9))

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Formula to replace a pivot table

    No advantage, just another way
    Please Login or Register  to view this content.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: Formula to replace a pivot table

    Quote Originally Posted by Bob Phillips View Post
    Use

    =SUMPRODUCT((Data!$C$2:$N$2=$B$1)*(Data!$B$3:$B$9=$B$3)*(Data!$C$3:$N$9))
    My data range is always changing in terms of numbers of rows

    Have tried updating your formula to remove the row numbers, but it no longer works :

    =SUMPRODUCT((Data!$C$2:$N$2=$B$1)*(Data!$B:$B=$B$3)*(Data!$C:$N))

    Any ideas?

  5. #5
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: Formula to replace a pivot table

    uh-oh. Don't use Sumproduct with whole column ranges. No better way to slow down a fast computer. Define dynamic range names instead and plug those into the formula.

    Define these three range names

    Grouping =Data!$B$3:INDEX(Data!$B:$B,MATCH("zzzz",Data!$B:$B,1))
    DataTable =OFFSET(Grouping,0,1,,COUNTA(Data!$2:$2)-2)
    Months =Data!$C$2:INDEX(Data!$2:$2,MATCH(99^99,Data!$2:$2,1))

    Then change the sumproduct to

    =SUMPRODUCT((Months=$B$1)*(Grouping=$B$3)*(DataTable))

    PS: and get rid of the merged cells in row 1. Use "Center across selection" in the Alignment tab of the formatting dialog instead.

  6. #6
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Formula to replace a pivot table

    You should create a dynamic named range for the dates, the groups, and the numbers and use these in the formula.

  7. #7
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: Formula to replace a pivot table

    Quote Originally Posted by npamcpp View Post
    uh-oh. Don't use Sumproduct with whole column ranges. No better way to slow down a fast computer. Define dynamic range names instead and plug those into the formula.

    Define these three range names

    Grouping =Data!$B$3:INDEX(Data!$B:$B,MATCH("zzzz",Data!$B:$B,1))
    DataTable =OFFSET(Grouping,0,1,,COUNTA(Data!$2:$2)-2)
    Months =Data!$C$2:INDEX(Data!$2:$2,MATCH(99^99,Data!$2:$2,1))

    Then change the sumproduct to

    =SUMPRODUCT((Months=$B$1)*(Grouping=$B$3)*(DataTable))

    PS: and get rid of the merged cells in row 1. Use "Center across selection" in the Alignment tab of the formatting dialog instead.
    Thanks, that worked a treat, have attached solution for anyone who wants it in the future. Subtotal without pivot.xlsx

    Just now need to understand how these named range formulas work, is there any good articles to read??

  8. #8
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: Formula to replace a pivot table

    got errors editing my post

  9. #9
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: Formula to replace a pivot table

    A selection:

    Charley Kyd: http://www.exceluser.com/explore/dynname1.htm
    Excel is Fun video: http://www.youtube.com/watch?v=1x_hcmVqnyY
    Charles Williams: http://www.decisionmodels.com/optspeedf.htm
    Jan Karel Pieterse: http://www.jkp-ads.com/articles/ExcelNames07.asp

    I personally use Offset only sparingly, but for range names it's often less work to use Offset rather than to construct a range name from scratch with Index. There are trade-offs regarding speed and volatility, but if your workbook is not overly large, you probably won't notice a difference.

  10. #10
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: Formula to replace a pivot table

    Thanks

    The links all seem to use the offset function, which I was familiar with. It's the index and match within an offset that I'm trying to get my head around. Like why you match "zzzz" or 99^99

    I've implemented your names and formulas into my actual sheet (Not the simple example I posted) and its not covering the whole range due to blank rows I think. Starting to drive me mad lol
    Last edited by benoj2005; 05-21-2012 at 09:02 AM.

  11. #11
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Formula to replace a pivot table

    =SUMIFS(INDEX(Data!$B:$N,,MATCH($B$1,Data!$B$2:$N$2,0)),Data!$B:$B,$B$3)
    since you're using 2007
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  12. #12
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: Formula to replace a pivot table

    Quote Originally Posted by JosephP View Post
    =SUMIFS(INDEX(Data!$B:$N,,MATCH($B$1,Data!$B$2:$N$2,0)),Data!$B:$B,$B$3)
    since you're using 2007
    Oh that's better, it looks messier in the formula bar than having named ranges and may take more resources, but I can't get the named ranges to cover the correct areas, so this will have to do. Thanks

  13. #13
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Formula to replace a pivot table

    See this workbook for another approach to Dynamic Names, it might help.
    I have used
    Please Login or Register  to view this content.
    To get your result, I only have 2003 at the moment.

    This approach should handle blanks.
    Attached Files Attached Files
    Last edited by Marcol; 05-21-2012 at 09:44 AM. Reason: Redundancy in formula

  14. #14
    Forum Contributor
    Join Date
    02-14-2012
    Location
    Warrington
    MS-Off Ver
    Excel 365
    Posts
    377

    Re: Formula to replace a pivot table

    Quote Originally Posted by Marcol View Post
    See this workbook for another approach to Dynamic Names, it might help.
    I have used
    Please Login or Register  to view this content.
    To get your result, I only have 2003 at the moment.

    This approach should handle blanks.
    Thanks

    I've gone with the sumif function posted by "JosephP" as this is the easiest for me to re-create.

    If anyone could explain the dynamic name formulas they have posted, for Example...
    Please Login or Register  to view this content.
    Like that broken down, then I could understand it and use in the future.

  15. #15
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Formula to replace a pivot table

    Note I have edited post #13

    I'll explain later how the Dynamic Ranges work, if no one else does. Got to go for now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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