+ Reply to Thread
Results 1 to 3 of 3

Formula too long

Hybrid View

  1. #1
    Registered User
    Join Date
    03-03-2011
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    16

    Formula too long

    I am working on building a summary sheet that pulls data from a pivot table. The pivot table pulls data monthly. The summary sheet has all months of the year pre-defined and thus will have months without any data in the pivot table. I was trying to use the if(iserror code to write a "$0" in the out months but my code is too long. Wondering if you have any thoughts on how to make this usable.

     '   Range("G9").Select
     '   ActiveCell.FormulaR1C1 = _
     '   "=IF(ISERROR(GETPIVOTDATA(""Total_Cost"",'Summary Financial'!R3C1,""Req_project_code"",""" & PBPNum & """,""Time_step_num"",""002"",""Month"",1)+(GETPIVOTDATA(""Total_Cost"",'Summary Financial'!R3C1,""Req_project_code"",""" & PBPNum & """,""Time_step_num"",""003"",""Month"",1)+(GETPIVOTDATA(""Total_Cost"",'Summary Financial'!R3C1,""Req_project_code"",""" & PBPNum & """,""Time_step_num"",""005"",""Month"",1))=TRUE,""$0"",(GETPIVOTDATA(""Total_Cost"",'Summary Financial'!R3C1,""Req_project_code"",""" & PBPNum & """,""Time_step_num"",""002"",""Month"",1)+(GETPIVOTDATA(""Total_Cost"",'Summary Financial'!R3C1,""Req_project_code"",""" & PBPNum & """,""Time_step_num"",""003"",""Month"",1)+(GETPIVOTDATA(""Total_Cost"",'Summary Financial'!R3C1,""Req_project_code"",""" & PBPNum & """,""Time_step_num"",""005"",""Month"",1)))"
    Thanks!
    Last edited by dem86; 03-10-2011 at 05:57 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Formula too long

    You could perhaps try:

    Range("G9").FormulaR1C1 = "=LOOKUP(9.99E+307,CHOOSE({1,2},0,GETPIVOTDATA(""Total_Cost"",'Summary Financial'!R3C1,""Req_project_code"",""" & PBPNum & """,""Time_step_num"",""002"",""Month"",1)+GETPIVOTDATA(""Total_Cost"",'Summary Financial'!R3C1,""Req_project_code"",""" & PBPNum & """,""Time_step_num"",""003"",""Month"",1)+GETPIVOTDATA(""Total_Cost"",'Summary Financial'!R3C1,""Req_project_code"",""" & PBPNum & """,""Time_step_num"",""005"",""Month"",1)))"

  3. #3
    Registered User
    Join Date
    03-03-2011
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Formula too long

    Thank you very much!!!!

+ 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