+ Reply to Thread
Results 1 to 5 of 5

Variable for Criteria in SUMIF Formula

  1. #1
    Registered User
    Join Date
    01-10-2013
    Location
    Tallahassee
    MS-Off Ver
    Excel 2010
    Posts
    30

    Variable for Criteria in SUMIF Formula

    I am having trouble with a SUMIF formula. I want to select the value for my SUMIF criteria from a cell that is one row above and two columns to the right.

    This works
    Please Login or Register  to view this content.
    This does not work
    Please Login or Register  to view this content.
    The result must be a formula and not a value. The numbers added may change at any time and only the numbers associated with the code one row above and two columns to the right of RngCell should be associated. That code can change.

    Thank you for your help.

  2. #2
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Variable for Criteria in SUMIF Formula

    You need to do it like this:
    Please Login or Register  to view this content.
    Note: I am not sure if you want to use SumCriteria or SumIfCriteria?
    Note: I also removed the extra brackets that were not required.
    Regards,
    Stephen

    If you feel someone has helped you please thank them and click on the star on their post to add reputation.
    Please ensure that you use code tags where relevant, and mark solved threads as solved.
    Most of all please be respectful and understanding of others.

  3. #3
    Registered User
    Join Date
    01-10-2013
    Location
    Tallahassee
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Variable for Criteria in SUMIF Formula

    Works nicely, Stephen. Thank you.

    Before I close this, I hope you can help me with one other item. I don't require this, but if I had wanted it, how would I add from C4 to LastRow to the SUMIF formula?

    I am confused with where the quotations go. I have left the quotations that you so helpfully added in your answer. Thank you.
    --Perry

    Please Login or Register  to view this content.



    Quote Originally Posted by spitfireblue View Post
    You need to do it like this:
    Please Login or Register  to view this content.
    Note: I am not sure if you want to use SumCriteria or SumIfCriteria?
    Note: I also removed the extra brackets that were not required.

  4. #4
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Variable for Criteria in SUMIF Formula

    Basically you don't want quotes around your variables otherwise they will be treated as string/text.
    So when you replace the code with a variable you have to close the quote then & then your variable and then & and then begin your quote again.

    Please Login or Register  to view this content.
    Last edited by spitfireblue; 03-15-2017 at 05:21 PM.

  5. #5
    Registered User
    Join Date
    01-10-2013
    Location
    Tallahassee
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Variable for Criteria in SUMIF Formula

    It is a lot clearer now. Thank you for your time.

+ 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] variable criteria in sumif formula
    By davemon in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-09-2015, 10:21 PM
  2. SUMIF or SUMIF's formula with multiple criteria
    By jackiemariee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-30-2013, 06:19 PM
  3. sumif with fixed and variable criteria
    By bufharry in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 12-21-2010, 04:23 AM
  4. SUMIF formula - adding another variable..
    By AllenMead in forum Excel General
    Replies: 2
    Last Post: 09-30-2010, 09:39 AM
  5. inserting variable filename into sumif formula
    By sirensiren in forum Excel General
    Replies: 6
    Last Post: 01-08-2010, 05:20 AM
  6. sumif with a variable criteria and polynomial problem
    By Niels in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-29-2006, 10:11 AM
  7. how to use a variable for the criteria in a sumif function?
    By Dick B. in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-01-2006, 08:00 AM

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