Sum a range if range of cells contains a specific word in a text string

wakefield101

New Member
Joined
Jan 4, 2014
Messages
31
Hi I am trying to figure out what appeared to be a simple formula however I thought wrong.

Does anyone know how to have a SUMIF apply if a cell contains a certain text?

Here is the formula that I have now, which is not working... =SUMIF(AJ1:BC1,"=*Reserved*",OR("=*Actuals*"),AJ2:BC2)

What I want the formula to say is, if the range of cells have the word "Reserved" in it, then sum all corresponding rows, if not than sum the range with the word "Actuals" in the cell

Here is an example of the data I am using.

Excel Workbook
AJAKALAMANAOAPAQARAS
1FEB-2016 ReservedFEB-2016 ActualsMAR-2016 ReservedMAR-2016 ActualsAPR-2016 ReservedAPR-2016 ActualsMAY-2016 ReservedMAY-2016 ActualsJUN-2016 ReservedJUL-2016 Reserved
2000000.240000
300000.2401011
4000.0900.1800.1800.180.18
5000000000.840.88
6000000000.460.84
Data


If thee is a another way then the sumif formula, please let me know.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I just tried this formula:

=SUM(IF(ISNUMBER(SEARCH("Actuals",AJ1:BC1)),AJ2:BC2,IF(ISNUMBER(SEARCH("Reserved",AJ1:BC1)),AJ2:BC2,"ERROR")))

and

=SUM(IF(ISNUMBER(SEARCH("*Actuals*",AJ1:BC1)),AJ2:BC2,IF(ISNUMBER(SEARCH("*Reserved*",AJ1:BC1)),AJ2:BC2,"ERROR")))


However, I received a #value error. Excel Formula Evaluation says that it can't determine values for AJ1:BC1 (which are my headers)...
 
Upvote 0
I am confused as to what you are trying to take the sum of. Do you want the sum of all of the columns where the header says Reserved and then another sum of all of the columns where the header says Actuals? Or do you want the individual row sums where the title is Reserved etc.

If you can make a very small sample data that shows all of the columns and rows I think it might help here.

 
Upvote 0
Hi,

Shouldn't you have the Totals separated instead of in the same Column?, Here're both ways:


Excel 2010
AKALAMANAOAPAQARASATAUAV
1FEB-2016 ActualsMAR-2016 ReservedMAR-2016 ActualsAPR-2016 ReservedAPR-2016 ActualsMAY-2016 ReservedMAY-2016 ActualsJUN-2016 ReservedJUL-2016 ReservedTotal ReservedTotal ActualsMixed Total
200000.24000000.240.24
30000.24010113.2403.24
400.0900.1800.1800.180.180.8100.81
500000000.840.881.7201.72
600000000.460.841.301.3
Sheet1
Cell Formulas
RangeFormula
AT2=SUMIF(AJ$1:AS$1,"*Reserved*",AJ2:AS2)
AU2=SUMIF(AJ$1:AS$1,"*Actuals*",AJ2:AS2)
AV2=IF(SUMIF(AJ$1:AS$1,"*Reserved*",AJ2:AS2)=0,SUMIF(AJ$1:AS$1,"*Actuals*",AJ2:AS2),SUMIF(AJ$1:AS$1,"*Reserved*",AJ2:AS2))

Formulas copied down.
 
Last edited:
Upvote 0
WOW, as I was typing, I realized that I was trying to work the wrong formula. Stupid...

I just realized that I had the formula that I needed about 2 hours ago....

Sorry for the confusion and thanks for the help..
 
Upvote 0
You're welcome, 2 hours ago was when you posted your question.;)
 
Upvote 0
Yes exactly Jtakw. haha wow and the formulas that you wrote in the above thread were the exact formulas that I figured out this morning (its 13.30 right now)......

For some stupid reason, I had it in my head to combine the formulas, little did I think that what I was trying to do was contradicting... Time to step away for 15 minutes and clear my head hahaha
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top