how to use a variable for the criteria in a sumif function?

Discussion in 'Microsoft Excel Worksheet Functions' started by Guest, Apr 28, 2006.

  1. Guest

    Guest Guest

    I am trying to use a named variable for the criteria in a sumif function.
    =sumif(A1:A4,"currentjobno",B1:B4)
    currentjobno has a value of 38006
     
    Guest, Apr 28, 2006
    #1
    1. Advertisements

  2. Guest

    Guest Guest

    Remove the quotes.

    =sumif(A1:A4,currentjobno,B1:B4)

    HTH,
    Elkar


    "Dick B." wrote:

    > I am trying to use a named variable for the criteria in a sumif function.
    > =sumif(A1:A4,"currentjobno",B1:B4)
    > currentjobno has a value of 38006
     
    Guest, Apr 28, 2006
    #2
    1. Advertisements

  3. Guest

    Guest Guest

    I didn't think it was possible to define a variable in "just" Excel. I
    thought this had to be do in VB. If I've got it wrong then how do you define
    variables in Excel?

    Thanks

    Ian

    "Elkar" wrote:

    > Remove the quotes.
    >
    > =sumif(A1:A4,currentjobno,B1:B4)
    >
    > HTH,
    > Elkar
    >
    >
    > "Dick B." wrote:
    >
    > > I am trying to use a named variable for the criteria in a sumif function.
    > > =sumif(A1:A4,"currentjobno",B1:B4)
    > > currentjobno has a value of 38006
     
    Guest, Apr 28, 2006
    #3
  4. Guest

    Guest Guest

    I'm assuming he's referring to a single cell as a named range, rather than a
    variable. Although the effect is very similar.

    "Ian P" wrote:

    > I didn't think it was possible to define a variable in "just" Excel. I
    > thought this had to be do in VB. If I've got it wrong then how do you define
    > variables in Excel?
    >
    > Thanks
    >
    > Ian
    >
    > "Elkar" wrote:
    >
    > > Remove the quotes.
    > >
    > > =sumif(A1:A4,currentjobno,B1:B4)
    > >
    > > HTH,
    > > Elkar
    > >
    > >
    > > "Dick B." wrote:
    > >
    > > > I am trying to use a named variable for the criteria in a sumif function.
    > > > =sumif(A1:A4,"currentjobno",B1:B4)
    > > > currentjobno has a value of 38006
     
    Guest, Apr 28, 2006
    #4
  5. Guest

    Guest Guest

    Thanks, for a moment I thought a whole new area of Excel was going to open
    up, much the same as when I first found out that it was possible to use VB in
    worksheets.

    Ian

    "Elkar" wrote:

    > I'm assuming he's referring to a single cell as a named range, rather than a
    > variable. Although the effect is very similar.
    >
    > "Ian P" wrote:
    >
    > > I didn't think it was possible to define a variable in "just" Excel. I
    > > thought this had to be do in VB. If I've got it wrong then how do you define
    > > variables in Excel?
    > >
    > > Thanks
    > >
    > > Ian
    > >
    > > "Elkar" wrote:
    > >
    > > > Remove the quotes.
    > > >
    > > > =sumif(A1:A4,currentjobno,B1:B4)
    > > >
    > > > HTH,
    > > > Elkar
    > > >
    > > >
    > > > "Dick B." wrote:
    > > >
    > > > > I am trying to use a named variable for the criteria in a sumif function.
    > > > > =sumif(A1:A4,"currentjobno",B1:B4)
    > > > > currentjobno has a value of 38006
     
    Guest, Apr 29, 2006
    #5
  6. Guest

    Guest Guest

    Thanks, Yes I have a single cell as a named range. It works great.
    Thanks


    "Ian P" wrote:

    > Thanks, for a moment I thought a whole new area of Excel was going to open
    > up, much the same as when I first found out that it was possible to use VB in
    > worksheets.
    >
    > Ian
    >
    > "Elkar" wrote:
    >
    > > I'm assuming he's referring to a single cell as a named range, rather than a
    > > variable. Although the effect is very similar.
    > >
    > > "Ian P" wrote:
    > >
    > > > I didn't think it was possible to define a variable in "just" Excel. I
    > > > thought this had to be do in VB. If I've got it wrong then how do you define
    > > > variables in Excel?
    > > >
    > > > Thanks
    > > >
    > > > Ian
    > > >
    > > > "Elkar" wrote:
    > > >
    > > > > Remove the quotes.
    > > > >
    > > > > =sumif(A1:A4,currentjobno,B1:B4)
    > > > >
    > > > > HTH,
    > > > > Elkar
    > > > >
    > > > >
    > > > > "Dick B." wrote:
    > > > >
    > > > > > I am trying to use a named variable for the criteria in a sumif function.
    > > > > > =sumif(A1:A4,"currentjobno",B1:B4)
    > > > > > currentjobno has a value of 38006
     
    Guest, May 1, 2006
    #6
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest

    In a SUMIF function, can I use multiple ranges and criteria?

    Guest, Oct 14, 2004, in forum: Microsoft Excel Worksheet Functions
    Replies:
    1
    Views:
    237
    Frank Kabel
    Oct 14, 2004
  2. Guest

    How can I use a date as part of the criteria in a sumif function..

    Guest, Oct 15, 2004, in forum: Microsoft Excel Worksheet Functions
    Replies:
    1
    Views:
    174
    Frank Kabel
    Oct 15, 2004
  3. Guest

    Can I use a cell reference in the criteria for the sumif function.

    Guest, Nov 4, 2004, in forum: Microsoft Excel Worksheet Functions
    Replies:
    2
    Views:
    193
    Domenic
    Nov 4, 2004
  4. Guest

    Is it possible to use the sumif function based on the criteria of.

    Guest, Feb 2, 2005, in forum: Microsoft Excel Worksheet Functions
    Replies:
    1
    Views:
    195
    JulieD
    Feb 2, 2005
  5. Guest

    nested sumif or sumif with two criteria

    Guest, Apr 4, 2005, in forum: Microsoft Excel Worksheet Functions
    Replies:
    5
    Views:
    1,420
    Harlan Grove
    Apr 5, 2005
Loading...

Share This Page