+ Reply to Thread
Results 1 to 4 of 4

Need help combining three formulas for both Excel and VBA for automation.

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Need help combining three formulas for both Excel and VBA for automation.

    Is there a way to combine the formulas below into one?

    =SUMIFS(NT_TOT,NT_ID,_ID)

    =COUNTIFS(ID2,ID,CODE2,306,DT2,">.1")
    +COUNTIFS(ID2,ID,CODE2,307,DT2,">.1")


    =IF(ISERROR($G15/$H15),(G15),($G15/$H15))


    Right now it is just a formula in worksheet, however, I will be doing this report on a long-term basis and I will also need to automate it in VBA, so both formulas (if you know them) would be appreciated. I am very new to complex formulas in Excel and VBA code.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need help combining three formulas for both Excel and VBA for automation.

    Combine in what way? They calculate three different things.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Need help combining three formulas for both Excel and VBA for automation.

    1) =SUMIFS(NT_TOT,NT_ID,_ID) - totals items from one set of data

    2) =COUNTIFS(ID2,ID,CODE2,306,DT2,">.1")+COUNTIFS(ID2,ID,CODE2,307,DT2,">.1") - totals items from second set of data

    3) =IF(ISERROR($G15/$H15),(G15),($G15/$H15)) = sum of #1 divided by the sum of #2

    I'd like it if the cell only showed the result of the third formula after calculating the two.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need help combining three formulas for both Excel and VBA for automation.

    Ah. Maybe

    =SUMIFS(NT_TOT, NT_ID, _ID) * IFERROR(1/SUM(COUNTIFS(ID2, ID, CODE2, {306,307}, DT2, ">.1")), 1)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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