+ Reply to Thread
Results 1 to 1 of 1

HELP WIth Using GETPIVOTDATA and IF In VBA

  1. #1
    Registered User
    Join Date
    07-18-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    1

    HELP WIth Using GETPIVOTDATA and IF In VBA

    I am very new to the VBA scene, but am reasonably competent with using Excel.

    After a long time thinking about automating the analysis of data files from our equipment I have come a bit unstuck with with this particular function. I have got it to work perfrctly in the spreadsheet, but am having trouble translating it to VBA. Any help will be most appreciated!

    The actual formula in Excel is:

    =IF(0=GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),"0",
    IF(48>=GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),
    IF(24>=GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),
    24-GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),
    IF(48>=GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),
    48-GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),
    IF(72>=GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),
    72-GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),
    IF(96>=GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),
    96-GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),
    IF(0=GETPIVOTDATA("SAMPLE ID",$A$3,"PLATE NAME",A5,"ASSAY NAME","HCV0.6ml"),"0","Wrong")))))))


    Basically this formula takes the value from a pivot table and then checks to see if it is 0, <=24, <=48, <=72, <=96 and then return a the difference from the whole values. i.e. value from pivot table = 16, this values falls in the <=24 and therefore calculates that the value is 8.

    Does anyone have any idea how to replicate this in Excel VBA?

    Thanks for you help, from a very stumped newb.
    Last edited by JMB22SP; 07-18-2017 at 06:51 PM.

+ 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] GETPIVOTDATA – How to force getpivotdata to accept missing data
    By scottc_00 in forum Excel Formulas & Functions
    Replies: 39
    Last Post: 02-11-2015, 03:23 PM
  2. Getpivotdata
    By okl in forum Excel General
    Replies: 2
    Last Post: 07-11-2011, 06:24 AM
  3. Getpivotdata
    By cmb80 in forum Excel General
    Replies: 1
    Last Post: 11-12-2010, 11:25 AM
  4. GetPivotData
    By abbymagga in forum Excel General
    Replies: 6
    Last Post: 08-04-2010, 10:24 AM
  5. GETPIVOTDATA value
    By ashwin_bist in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-03-2009, 04:12 AM
  6. getpivotdata
    By Alice in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-23-2006, 12:30 PM
  7. [SOLVED] GetPivotData ???
    By Eric in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-18-2005, 05: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