Hi all
I'm not a programmer of any sort, and i have little experience working with code and computer languages and such. I want to use the SumIf function to sum cells when other cells begin with certain characters.
I've toyed with a few ideas of how this could work, but i don't know how to specify that the cells need to begin with certain characters. The cells that would be the criteria and the ones that would be summed come out of an Oracle database (and i have no control over the way they're pulled out - yet) so the beginning characters are connected to extremely unique information, so i dont want that to be included in the if part, for obvious reasons.
Any pointers? Thanks in advance!
Let's assume that the cells of interest begin with the characters "ABC", try...
=SUMIF(Range,"ABC*",RangeToSum)
or
SUMIF(Range,A2amp;"*",RangeToSum)
...where A2 contains ABC.
Hope this helps!
Yeah that does help! Thats exactly what i asked for! Thank you so much! A very quick reply too!
But now there's a new problem (of course). I have these beginnings of text strings that are AD, AD TO, and AD TR. I want this equation to sum the AD only ones, so not AD TO and AD TR. Can i use the SumIfs (the one with multiple criteria) or is there a way to say "do this if this true but NOT this" in the SumIf function? If i can use the SumIfs function, how do i specify the "not" criteria?
Thanks again!
Originally Posted by eschiesserYeah that does help! Thats exactly what i asked for! Thank you so much! A very quick reply too!
But now there's a new problem (of course). I have these beginnings of text strings that are AD, AD TO, and AD TR. I want this equation to sum the AD only ones, so not AD TO and AD TR. Can i use the SumIfs (the one with multiple criteria) or is there a way to say "do this if this true but NOT this" in the SumIf function? If i can use the SumIfs function, how do i specify the "not" criteria?
Thanks again!Code:
=SUMPRODUCT( --ISNUMBER(SEARCH(" "amp;A2amp;" "," "amp;$E$2 E$100amp;" ")), $F$2 F$100)
where A2 houses a substring like AD, E2:E100 is the search Range, and F2:F100 is the RangeToSum.
Thanks for the help Aladin! Unfortunately, that Sumproduct formula doesn't seem to be exempting the "AD TO..." and "AD TR..." entries from the summary.
I've been messing around with the SumIfs formula, and this is what i have so far:
=SUMIFS(DKOPP!I15:I23,DKOPP!D15 23,D2amp;"*",DKOPP!D15 23,DKOPP!D15 23D3amp;"*")
now, this should be returning a value of 9.75, but it is returning zero. If it were summing cells that correspond to the "AD TO..." and "AD TR..." fields as well, it would be 11.5. What do i have to do to make this work?
I have found a fairly simple and effectively equivalent work-around, where i simply subtract the cells that contain the sums of the "AD TO..." and "AD TR..." entries from the total sum of all three types of entries, to give me the "AD..." only entries. However, I'd still like to know what the problem with the SumIfs formula is.
Thanks again for the help guys, this is saving me a lot of time.
Originally Posted by eschiesserThanks for the help Aladin! Unfortunately, that Sumproduct formula doesn't seem to be exempting the "AD TO..." and "AD TR..." entries from the summary.
I've been messing around with the SumIfs formula, and this is what i have so far:
now, this should be returning a value of 9.75, but it is returning zero. If it were summing cells that correspond to the "AD TO..." and "AD TR..." fields as well, it would be 11.5. What do i have to do to make this work?
I have found a fairly simple and effectively equivalent work-around, where i simply subtract the cells that contain the sums of the "AD TO..." and "AD TR..." entries from the total sum of all three types of entries, to give me the "AD..." only entries. However, I'd still like to know what the problem with the SumIfs formula is.
Thanks again for the help guys, this is saving me a lot of time.
Would you provide a tiny sample, a criterion for which to sum, and the expected sum?
Im summing the ones that begin with "AD..." WITHOUT the on beginning with "AD TO.." These arent the only entries that may have AD or AD TO so thats why i have to use the wildcard asterisk thing. I want the SumIfs formula to add up all the Numbers that are attached to "AD..." while excluding the ones with "AD TO..."
I should get 3.25 for the "AD..." sums without the "AD TO...", 4.25 with, but i get a return of 0 for the current SumIfs. Any ideas?
This is the only way i could figure out how to show the cells.
Couldn't you try something like :
=SUMIF(Range,"AD*",RangeToSum)-SUMIF(Range,"AD TO*",RangeToSum)-SUMIF(Range,"AD TR*",RangeToSum)
Thats exactly what i did to get around it, but I'm curious as to how i would use SumIfs to write a criterion that says "add up this, but not this." The "but not this" part is giving me some trouble. I'm thinking it will help me in the future when i dont have that option. "give a man a fish..."
All the help is much appreciated. There are some clever thinkers in these forums. |