+ Reply to Thread
Results 1 to 8 of 8

Multiple values in one cell for sumif function

  1. #1
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Multiple values in one cell for sumif function

    Hi, I need to use the sumif function to return some no., however some of the criteria cell has more than one value (range of values), so how can I key the criteria cell so that the sumif function returns the value? Please help. Many thanks !

    E.g.
    GL Amount
    1000 =sumif(xxx
    1800-2000
    2100-2110
    Last edited by bernard.x; 11-08-2010 at 08:50 AM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Multiple values in one cell for sumif function

    And what is your criteria to sum?

  3. #3
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Multiple values in one cell for sumif function

    The criteria is the GL no. e.g. 1000, 1800, 2000,etc. There is a correspondence amount for each GL, in another tab, however I'm unable to use the sumif function in this tab because the GL no. is a range, e.g. from 1800 to 2000. Please see the attachment.
    Attached Files Attached Files
    Last edited by bernard.x; 11-08-2010 at 07:41 AM.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Multiple values in one cell for sumif function

    It might be easier to split your ranges out into 2 columns then you could use a regular SUMIFS formula, otherwise.....

    Assuming the ranges are in column A, always separated by a hyphen and the amount to sum in column B then with a specific GL in D2 use this formula in E2

    =SUM(IF((D2>=IFERROR(LEFT(A$1:A$100,FIND("-",A$1:A$100)-1)+0,0))*(D2<=IFERROR(REPLACE(A$1:A$100,1,FIND("-",A$1:A$100),"")+0,0)),B$1:B$100))

    confirmed with CTRL+SHIFT+ENTER
    Audere est facere

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Multiple values in one cell for sumif function

    Or, as daddylongs already said, if you can write only first numbers in your cells.. Your formula might become much simplier:

    (note that if you write 1000-1800, 1810-2200, 2210 - ...) is same as up to 1000, 1800, 2200...
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Multiple values in one cell for sumif function

    Hi, thanks a lot, but I need to sum up the GL range in a different tab, the original trial balance consist of the amount for each GL, but in the output tab, I need to sum up the GLs. Please see the enclosed attachment.
    Attached Files Attached Files

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Multiple values in one cell for sumif function

    OK, I misunderstood, assumed you had ranges in the data not as criteria. If you use your original approach you can use this formula in C14 copied down

    =SUMIF('Trial Balance'!A:A,">="&A14,'Trial Balance'!B:B)-SUMIF('Trial Balance'!A:A,">"&B14,'Trial Balance'!B:B)

    or in Excel 2007 you can use SUMIFS like this for the same result

    =SUMIFS('Trial Balance'!B:B,'Trial Balance'!A:A,">="&A14,'Trial Balance'!A:A,"<="&B14)

    Note: those formulas both make the range "inclusive", i.e. with a range 1600-2000 both 1600 and 2000 will be included

  8. #8
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Multiple values in one cell for sumif function

    Quote Originally Posted by daddylonglegs View Post
    OK, I misunderstood, assumed you had ranges in the data not as criteria. If you use your original approach you can use this formula in C14 copied down

    =SUMIF('Trial Balance'!A:A,">="&A14,'Trial Balance'!B:B)-SUMIF('Trial Balance'!A:A,">"&B14,'Trial Balance'!B:B)

    or in Excel 2007 you can use SUMIFS like this for the same result

    =SUMIFS('Trial Balance'!B:B,'Trial Balance'!A:A,">="&A14,'Trial Balance'!A:A,"<="&B14)

    Note: those formulas both make the range "inclusive", i.e. with a range 1600-2000 both 1600 and 2000 will be included
    Hi, oh yes, the above formula works. Thanks a lot guys (zbor & daddylong). Cheers
    On a related note, if the GL no. is not a range, e.g. 1800 & 2000, any suggestion on how the formula should be? I know I can sum up the two GLs by changing the formula, but I will like to avoid doing so, as it would be tedious and hard to keep track. I am thinking of adding more columns by the side or use a lookup against another small table, any suggestions please? Thanks.
    Last edited by bernard.x; 11-08-2010 at 09:00 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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