+ Reply to Thread
Results 1 to 7 of 7

Apply SUMIFS Formula to an Array

  1. #1
    Registered User
    Join Date
    06-01-2016
    Location
    Zurich
    MS-Off Ver
    Office 2016
    Posts
    9

    Apply SUMIFS Formula to an Array

    Hi all,

    Im am trying to come up with a way to have my SUMIFS Formula loop through an array within the formula itself.
    here's the code I'm using:

    Please Login or Register  to view this content.
    Now Energy is a String which reference which works fine, but my formula gets stuck on "Ccy".
    I thought about doing a "For Each" loop but I would still need to provide the Currency Array in the formula which would take me back to square one...
    If you have any pointers that would be great!

    Thanks in advance.

    Best,
    Allen

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Apply SUMIFS Formula to an Array

    Hi,

    First off, that isn't a formula, it is code. Secondly, you are not doing anything with the result of the calculation, so what you have posted makes little sense. Could you perhaps explain what exactly it is that you want to do? Looping through the array is perfectly feasible, by the way, but shouldn't be necessary- you do need to add a Sum function though, I imagine, and use Application.Sumifs rather than WorksheetFunction.Sumifs.
    Last edited by xlnitwit; 10-12-2017 at 10:39 AM.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    06-01-2016
    Location
    Zurich
    MS-Off Ver
    Office 2016
    Posts
    9

    Re: Apply SUMIFS Formula to an Array

    hi xlnitwit

    yes indeed - the subject is misleading.
    The goal is to run through each of the currencies and skip the ones that return 0 and paste all other ones in a specific range. I want to try and do the rest on my own so I know what I am doing but I've been stuck here for a few hours now... So are you then saying that my "For Each" Loop should then work?
    I attached a print screen of what i want the end result to look like.


    Breakdown_Example_ExcelForum.JPG

    Thanks and best,
    Allen

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Apply SUMIFS Formula to an Array

    In that case, yes you need a loop. What did you try and what happened?

  5. #5
    Registered User
    Join Date
    06-01-2016
    Location
    Zurich
    MS-Off Ver
    Office 2016
    Posts
    9

    Re: Apply SUMIFS Formula to an Array

    i always get a type mismatch at the line below
    Please Login or Register  to view this content.
    If I change the "Ccy" to for example "AUD" I get the correct result, but let me in this case try and set up the mentioned "For Each" Loop.

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Apply SUMIFS Formula to an Array

    I mentioned earlier that in order to use the array you would need Application.Sumifs and not Worksheetfunction.Sumifs. However, you need a loop since you want to test each currency in turn.

  7. #7
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Apply SUMIFS Formula to an Array

    maybe
    Please Login or Register  to view this content.
    Ccy(0) means "AUD"
    Ccy(1) means "BRL" etc.

+ 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] Apply date range to SUMIFS formula
    By fahadmohsin in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-09-2016, 05:08 AM
  2. Need to apply a Vlookup formula from VBA to excel in an array
    By jmacinnees in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2014, 01:35 AM
  3. [SOLVED] Sumifs Array formula
    By Redcoal in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-19-2014, 11:03 PM
  4. SumIfs with array formula
    By mz1378 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-16-2012, 06:03 AM
  5. How to apply ISERROR in an Array Formula
    By kborgers in forum Excel General
    Replies: 4
    Last Post: 01-13-2012, 03:38 PM
  6. Array Formula with SumIFS
    By Avinash Beepath in forum Excel General
    Replies: 5
    Last Post: 02-02-2011, 01:45 PM
  7. Using VLOOKUP to apply an ARRAY formula
    By monkdelafunk in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-29-2008, 10:22 PM

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