Search code examples
excel-formulasumifs

Sumifs range with beginning and ending end criteria only


I want to sum a range in a column starting when Excel sees a certain account number and ending when it sees another. I won't know all the account numbers in between but they will always be in order so if it can recognize the first number and start to the last, that would be awesome. Account number has a '-' in it, so it's a string. This is for Workiva, not Excel so VBA is not an option.

Example:

1000-0000 52
1200-0001 100
1400-0001 100 
1410-0001 60
1500-0001 40
1510-0002 50
1610-0003 50

Sum all accounts from 1400-0001 through 1599-9999. Excel sees 1400-0001 (will always be first) and starts summing until it reaches something that doesn't start with 14XX-XXXX or 15XX-XXXX. Final output = 250


Solution

  • SUMIFS does not care if it is a string or numbers on the compare:

    =SUMIFS(B:B,A:A,">="&"1400-0001",A:A,"<="&"1599-9999")
    

    enter image description here