*This tutorial will teach you a few easy ways to sum multiple columns in Excel based on a single or multiple criteria.*

Doing a conditional sum in Excel is a piece of cake as long as all the values to be totaled are in one column. Summing multiple columns is a problem because both the SUMIF and SUMIFS functions require the sum range and criteria ranges to be equally sized. Luckily, when there is no straight way to do something, there is always a work-around :)

## Excel Sum If: multiple columns, single criterion

First off, let's get to know exactly what problem we are trying to solve. Suppose you have a table of monthly sales like shown below. Because it was consolidated from a number of regional reports, there are a few records for the same product:

The question is - how do you get a total of sales for a certain item?

The first idea that comes to mind is using a SUMIF formula in its pure form:

`=SUMIF(A2:A10, "apples", C2:E10)`

Unfortunately, this won't work. The reason is that the dimensions of *sum_range* are determined by Excel automatically based on the dimensions of the *range* argument. As our criteria range includes only one column (A2:A10), so does the sum range (C2:C10). The *sum_range* parameter defined in the formula (C2:E10) actually determines only the upper left cell of the range that will be summed. As a result, the above formula will add up the apples sales only in column C. Not what we are looking for, eh?

The simplest working solution that suggests itself is to create a helper column summing the numbers for each individual row, and then use that column for *sum_range*.

So, go ahead and place a SUM formula in F2, then drag it down across as many cells as needed:

`=SUM(C2:E2)`

After that, you can quickly have the job done:

`=SUMIF(A2:A10, I1, F2:F10)`

Where I1 is the item of interest.

In the above formula, *sum_range* is of the same size as *range* (1 column and 9 rows), so it works without a hitch:

If the layout of your worksheet does not have room for any extra columns, then apply one of the following solutions.

### SUMIF multiple columns

The idea is to write a separate SUMIF formula for each of the columns you want to sum, and then add up the results:

Or

A practical implementation looks as follows:

`=SUM(SUMIF(A2:A10,H1,C2:C10), SUMIF(A2:A10,H1,D2:D10), SUMIF(A2:A10,H1,E2:E10))`

Or

`=SUMIF(A2:A10, H1, C2:C10) + SUMIF(A2:A10, H1, D2:D10) + SUMIF(A2:A10, H1, E2:E10)`

You can also "hardcode" the condition in the formula if needed:

`=SUMIF(A2:A10, "Apples", C2:C10) + SUMIF(A2:A10, "Apples", D2:D10) + SUMIF(A2:A10, "Apples", E2:E10)`

This works fine for a reasonable number of columns, but for a large dataset the formula becomes too long and difficult to read. In this case, the below solutions are more appropriate.

### SUM as array formula

Another way to do a sum if in multiple columns based on one criterion is to construct an array formula:

*sum_range*) * (--(

*criteria_range*=

*criteria*)))

For our sample dataset, the formula takes this form:

`=SUM((C2:E10)*(--(A2:A10=H1)))`

Or

`=SUM((C2:E10)*(--(A2:A10="Apples")))`

In Excel 2019 and older, you should press Ctrl + Shift + Enter to complete the formula correctly. In Excel 365 and Excel 2021, this works as a normal formula due to inbuilt support for dynamic arrays.

**How this formula works:**

The core concept is to multiply the elements of these two arrays:

- (C2:E10) - all the values in the sum range. In our case, the array contains 27 elements (3 columns and 9 rows: {250,120,210;155,180,210;130,175,125; …}
- (--(A2:A10=H1)) - compares each value in A2:A10 against the target item in H1. The result is an array of TRUE (the condition is met) and FALSE (the condition is not met) values, which is then converted into an array of 1's and 0's with the help of a double unary operator: {0;1;0;0;1;0;0;1;1}

Please pay attention that the first array is two-dimensional (each column of data is separated by a comma and each row by a semicolon) and the second one is a one-dimensional vertical array (1 column of data, rows are separated by semicolons). When the two arrays are multiplied, all the items of the 2D array in a given row are multiplied by the corresponding element of the 1D array:

As multiplying by zero gives zero, only the numbers for which the criterion is TRUE survive, and the SUM function adds them up:

`=SUM({0,0,0;155,180,210;0,0,0;0,0,0;160,140,170;0,0,0;0,0,0;…})`

To make the formula's logic easier to understand, you can write the first multiplier in this way:

`=SUM((C2:C10 + D2:D10 + E2:E10) * (--(A2:A10=H1)))`

This will produce an array of sums by row (like the helper column does in the very first example), which is then multiplied by an array of 1's and 0's:

`{580;545;430;615;470;750;550;620;570}*{0;1;0;0;1;0;0;1;1}`

The result of multiplication is served to SUM:

`=SUM({0;545;0;0;470;0;0;620;570})`

Don't like using arrays formulas in your sheet? Neither do I. Well, let's go check the next solution :)

### SUMPRODUCT formula

The strategy described in the above example can also be implemented using the SUMPRODUCT function.

*sum_range*) * (

*criteria_range*=

*criteria*))

A real-life formula goes as follows:

`=SUMPRODUCT((C2:E10) * (A2:A10=H1))`

The formula's logic is the same as in the previous example. The beauty of the SUMPRODUCT function is that it supports arrays natively, so it works nicely as a regular formula in all Excel versions.

## Excel Sum If: multiple columns, multiple criteria

The three approaches we utilized to add up multiple columns with one criterion will also work for conditional sum with multiple criteria. The formulas will just become a little more complex.

### SUMIFS + SUMIFS to sum multiple columns

To sum cells that match multiple criteria, you normally use the SUMIFS function. The problem is that, just like its single-criterion counterpart, SUMIFS doesn't support a multi-column sum range. To overcome this, we write a few SUMIFS, one per each column in the sum range:

Or

For example, to sum Grapes sales (H1) in the North region (H2), the formula is:

`=SUMIFS(C2:C10, A2:A10, H1, B2:B10, H2) + SUMIFS(D2:D10, A2:A10, H1, B2:B10, H2) + SUMIFS(E2:E10, A2:A10, H1, B2:B10, H2)`

### Array formula to conditionally sum multiple columns

The SUM formula for multiple criteria is very much like that for a single criterion - you just include additional criteria_range=criteria pair(s):

*sum_range*) * (--(

*criteria_range1*=

*criteria1*)) * (--(

*criteria_range2*=

*criteria2*)))

For instance, to sum sales for the item in H1 and the region in H2, the formula goes as follows:

`=SUM((C2:E10) * (--(A2:A10=H1)) * (--(B2:B10=H2)))`

In Excel 2019 and older, remember to press Ctrl + Shift + Enter to make it an CSE array formula. In dynamic array Excel 365 and 2021, a normal formula will work fine as shown in the screenshot:

### SUMPRODUCT formula with multiple criteria

The easiest way to sum multiple columns based on multiple criteria is the SUMPRODUCT formula:

*sum_range*) * (

*criteria_range1*=

*criteria1*) * (

*criteria_range2*=

*criteria2*))

As you can see, it's very similar to the SUM formula, but does not require any extra manipulations with arrays.

To sum multiple columns with two criteria, the formula is:

`=SUMPRODUCT((C2:E10) * (A2:A10=H1) * (B2:B10=H2))`

These are the 3 ways to sum multiple columns based on one or more conditions in Excel. I thank you for reading and hope to see you on our blog next week!

## Practice workbook for download

Sum if multiple columns - examples (.xlsx file)

## 83 comments

Just wanted to say Thanks Alex, this sumproduct formula will save me time as the sumifs was not playing nice.

In your example 'Array formula to conditionally sum multiple columns':

=SUM((C2:E10) * (--(A2:A10=H1)) * (--(B2:B10=H2)))

If your column A had many types of fruit and you wanted to return the total sales value of say {"Apples","Grapes","Pears"} over the 3 months irrespective of Region, how would you include this, preferably in the syntax you have used in this example?

I would also like to replace the Month names for dates e.g. 01/03/2024 which I can then format as MMM-YY, so that I can then also add a filter (--(C1:N1<=Q1), where Q1 is the month I select from a drop down list - so that I can pick up 12 months worth of year-to-date values of whichever combinations of product in column A that I want, for whichever month I want.

Can I achieve both filters in the one formula using the SUM array syntax?

Hello! To use multiple criteria in column A, the formula might look something like this:

=SUMPRODUCT((C2:E10) * ((A2:A10=H1)+(A2:A10=I1)+(A2:A10=J1)) * (--(B2:B10=H2)))

Look for the example formulas here: Excel SUMPRODUCT function with formula examples.

Also note that formatting the date as MMM-YY does not change the date value in the cell. Try to use the recommendations described in this article: Excel IF between two dates.

I hope it’ll be helpful. If something is still unclear, please feel free to ask.

Thanks very much, that does help, shortens my formulae a bit and allows me to bring the date <= criteria in too.

However I was hoping there would be an even more concise way to write this part

((A2:A10=H1)+(A2:A10=I1)+(A2:A10=J1))

as I am referencing an external workbook and 11 or 12 different items (e.g.. fruit as in your example), so having to replicate the A2:A10= part 12 times over with a long file path & filename each time still makes the formula hard to read. Is there any other way to write this? Thankyou.

I'm really sorry, we cannot help you with this.

Hi, Alexander. Thanks for sharing this formula. Using your formula, I managed to get the exact sum of the value according to the criteria set forth. However, in order to make sense of the dynamic nature of the data, could you please help recommend me a formula that could:

1. Expand my columns dynamically to include larger size sample (according to my input), ie. from C13:P33 to C13:HO33. The values from Q33 to HO33 based on current sample are simply zero "0" OR

2. Ignore the column headers (referring to my data set below re characterized as "Group X") are meanwhile indicated as "#N/A" if not

Currently, my data looks to be:

Unit Unit 1 Unit 2 Unit 3 Unit 4 Unit 5

Group Group 1 Group 1 Group 2 Group 3 Group 3

Unit # 1 2 3 4 5

Column # 2 3 4 5 6

Speed Code Value Value Value Value Value

ABC 282735.9788 282735.9788 282735.9788 282735.9788 282735.9788

DEF 6274.64382 6274.64382 6274.64382 6274.64382 6274.64382

GHI 0 0 0 0 0

JKL 500 500 500 500 500

LMN 16203.75 23816.25 16203.75 16203.75 16203.75

The formula that worked so far is =SUM((Booking!$C$13:$P$33)*(--(Booking!$B$13:$B$33=M$12))*(--(Booking!$C$5:$P$5=$AD14))).

M12=Speed Code criteria while AD14=Group criteria.

For the 1st option, I've tried VLOOKUP & HLOOKUP to indicate a dynamic column range but these 2 didn't work.

While for the 2nd option, I've tried incorporating SUMIF as subset of SUM, alas - it didn't work as well.

Really hoping you could help me solve this issue as I've been working on this for a week already.

Thanks a lot!

Hi! If I understand your problem correctly, you can use dynamic named range. The following tutorial should help: How to create and use dynamic named range in Excel. You can also convert your range to an Excel table so your formulas automatically use the new data. You can also find useful information in this article: Structured references in Excel tables.

I hope it’ll be helpful.

had similar issue where my data was spread across multiple columns, but I only wanted to sum based on BOTH row & column criteria. The row criteria was a "single" row, so I was able to use INDIRECT combined w/MATCH to determine which row to add, then basic SUMIFS for my column criteria.

My data has item # down 1st column and weekly buckets across the top. I need to add all values w/in a month for a 'selected' item.

SUMIFS(INDIRECT("Export!"&MATCH($A2,Export!$A:$A,0)&":"&MATCH($A2,Export!$A:$A,0)),Export!$1:$1,">="&'Open and Planned'!C$1,Export!$1:$1,", =, <.

Does anyone have another/easier way to achieve the same?

looks like part of my message cut off. my formula is SUMIFS(INDIRECT("export!"&MATCH($A2,Export!$A:$A,0)&":"&MATCH($A2,Export!$A:$A,0)),Export!$1:$1,">="&'Open and Planned'!C$1,Export!$1:$1,"<"&'Open and Planned'!D$1)

where Export is the worksheet name that contains the sum range, cell A2 is the item #, cells C1/D1 are the start/end dates to check

Hi! It is very difficult to understand a formula that contains unique references to your workbook worksheets. Additionally, the formula has been incompletely written.

Can/how would you SUM multiple workbooks linked together that have a SUMIF formula? Basically trying to sum 29 workbooks with a SUMIF column with 1 condition.

Your explanation is not very clear, but perhaps you will find the Consolidate Sheets tool useful. It can summarize data from multiple worksheets. The tool is included in the Ultimate Suite for Excel and can be used in a free trial to see how it works.

Hi Alexander, how can I replace the '=' in criteria with to indicate a range - my formula returns #VALUE!

Sample of my formula shown below

=SUM((D:O)*(--(B:B>1099))*(--(B:B<1200))*(--(C:C<Last_FY)))

Thanks in advance

Nanette

Hi! Your formula is error free and should work. The error occurs as a result of your data, which I can't see and can't verify.

Hi Alexander, I am so grateful

your response encouraged me to keep testing my formulas against my data. I thought the problem was with using greater-than and less-than signs. What I found was that I was 1) needing to exclude my headings from my ranges of numbers; 2) Ctrl, Shift & Enter to enter my formula over an array.

Formulas that were 25 + lines long are now around 5 lines with correct outputs. One of my corrected formulas is shown below -

{=SUM(('CF InData'!$D2:$O5000)*(--('CF InData'!$B2:$B5000>=1100))*(--('CF InData'!$B2:$B5000<=1199))*(--('CF InData'!$C2:$C5000=1100","<=1199"},'CF InData'!$C:$C,"="&Last_FY))*1}

Thank you so sincerely :)

Hi Alexander

My formula did not copy well with bits being ignored between the greater than and less than signs again. You can delete my reply above, but I really did wish to thank you publicly.

Kind regards

Nanette

Hi I want to get sum

all data in same row with different columns

the criteria is lookup specific name & get sum of third column in same row

please keep in mind all data in same row but multiple columns

pleas share solution if any?

Hi! Unfortunately, this information is not enough to recommend a formula to you. To understand what you want to do, give an example of the source data and the expected result.

See my comment for the 'solution' I used which may work for you - a combination of INDIRECT & MATCH to obtain the row # for the sum range, then normal SUMIFS criteria to get the right column(s).

My data has item # down 1st column and weekly buckets across the top. I need to add all values w/in a month for a 'selected' item.

SUMIFS(INDIRECT("export!"&MATCH($A2,Export!$A:$A,0)&":"&MATCH($A2,Export!$A:$A,0)),Export!$1:$1,">="&'Open and Planned'!C$1,Export!$1:$1,"<"&'Open and Planned'!D$1)

where Export is the worksheet name that contains the sum range, cell A2 is the item #, cells C1/D1 are the start/end dates to check. Therefore, the SUMRANGE is the "row" on Export tab that matches the item #.

I don't know if this is the "right" way to go about this, but it works ;-)

This was so helpful! Thank you for explaining the different options in a way that is so comprehensive and easy to follow.

Hi

Column1 Prod a Prod B Prod C Prod D Prod E Prod F

January 1

January 1

January 1

January 1

February 1

February 0.5

March 1

How do I summarise the total for each product by month in the following table?

Jan Feb Mar Apr May Jun

Prod A

Prod B

Prod C

Prod D

Prod E

Prod F

Hi! For your data, you must use a separate formula for each sum. For example, product A for January:

=SUMIFS(B2:B100,A2:A100,"January")

Hai, i have a question, if i want to sum item,between month from januari to februari or from januari to march or only on januari, with the help of data validation so its change conditionally if i select certain month or the last three month. Please Help, Thank you.

Hello! I’m sorry, but your description doesn’t give me a complete understanding of your task. Maybe this guide will be helpful: SUMIF with dates.

Item code = column A

qty ordered = Column B

Needing to find a formula to look at item code in column A, and the qtys in column B and total together all qtys for specific item code on a separate sheet.

Please help I have tried (almost) everything. The data will be filled in over time, not all at once, so I need something ongoing.

Hi! You can see an example of the sum formula for item code in the second paragraph of this article: How to use SUMIF function in Excel. You can also find useful information in this article: Excel reference to another sheet or workbook (external reference). I hope my advice will help you solve your task.

I have a table containing sales unit data per month ( in each column) and a different column containing retail value of each SKU, I am trying to create a summary by category using sumproduct and sumifs but it gives me value error.

this is the formula i am using,

=SUMPRODUCT((G5:G34=N5)*(I4:K4=O4),H5:H34,I5:K34)

Here is the sample data table

Item# Des Cat SRP Jan Feb March

10122 NARS RCC CAFE CON LECHE RADIANT CREAMY CONCEALER 42 1 2 3

122610 NARS RCC MARRON GLACE RADIANT CREAMY CONCEALER 42 4 5 6

122710 NARS RCC TIRAMISU RADIANT CREAMY CONCEALER 42 7 8 9

12281 NARS RCC SUCRE D'ORGE RADIANT CREAMY CONCEALER 42 10 11 12

12291 NARS RCC WALNUT RADIANT CREAMY CONCEALER 42 13 14 15

Hi! You cannot multiply the values of arrays that have different sizes. (G5:G34=N5)*(I4:K4=O4) - impossible.

Hi,

I am trying to pull data from one tab to another, based on 2 descriptions. So the descriptions in 2 cells on Tab 1 e.g. E10:E64 and F10:F64 dictate if a figure (£) from a range of cells, say D1-D20 is copied into another cell, on another tab.

It works currently if one description dictates the data which is pulled across, using formula - SUMIF('Tab2'!E$10:E$64,B12,'Tab2'!I$10:I$63)

But I want both Criteria to be met, before the data is pulled across.

Any help is appreciated!

Hi! If you want to find an amount by two criteria, try using the SUMIFS function.

I am trying above formula where data is in one sheet and the formula in other sheet (same workbook) but its not working? while i tried same formula but in same sheet it worked. Is there restriction for using the formula in different sheet than the data sheet?

Hi! There are no such restrictions. I recommend that you read these recommendations: How to SUMIF between two sheets. I hope it’ll be helpful.

Hello!

The SUMIF function works fine between the sheets & I have no issue with that. What i was trying to use the sum array / sumproduct as explained above, but I was getting error. I made some research & found that the error is due to the header (containing alphabet characters) in Value column. It works only when the value column content are numbers only.

Thanks Alexander!

thank you so much for the detailed explanation!

may i ask if this is applicable to summing multiple rows with a single criteria?

How can i match 2 criteria and give result.

example:

Sheet 1

A1 = item code

B1= Location (4 different location)

result=?

Sheet2 is data sheet

A:A= item code

B:B=locations

C:C= value

so if a1 and b1 matches with a:a and b:b then total to be resut.

Hi! If I understand you correctly, to summarize values by multiple criteria, use the SUMIFS function. For more information, please visit: How to use Excel SUMIFS and SUMIF with multiple criteria. I hope it’ll be helpful. If something is still unclear, please feel free to ask.

=(SUMIFS('STK Sheet'!H16:H400,'STK Sheet'!E16:E400,"#4 ACSR",'STK Sheet'!C16:C400,"N"))*(SUMIFS('STK Sheet'!D16:D400,'STK Sheet'!E16:E400,"#4 ACSR",'STK Sheet'!C16:C400,"N"))

I have this formula which multiplies the linear footage of wire(column H) as long as column E shows a specific wire sizer and column C shows N for new wire. I have now created a column D that shows if there are 1, 2, or 3 wires at the location. the above formula does not work because it is taking the sum of the first statement and multiplying it by the sum of the 2nd. I need it to multiply each linear footage(H) by each number of wire(D) then sum all of that together.

H1*D1 + H3*D3 + H7*D7 etc.

any helpful tips?

Hi!

I’m sorry but your description doesn’t give me a complete understanding of your task. To find the sum of the multiplications of numbers, try the SUMPRODUCT function.

I tried this previously and still was unable to make it work the way I needed it to. If column E and C are true I need H and D to be multiplied and added respectively. Maybe I just was not writing my sumproduct correctly

I believe I figured it out.

=SUMPRODUCT(--('STK Sheet'!E16:E400="#4 ACSR"),--('STK Sheet'!C16:C400="N"),('STK Sheet'!H16:H400),('STK Sheet'!D16:D400))

As I am sure you know the "--" makes those columns into numerical values so that it serves the same purpose as the SUMIF criteria

may I ask how to add numbers from different column with #n/a (error) and text in cells and also hidden.

example: How to add this numbers from A1 to H1 ignoring error and text and also hidden column or to add the numbers selected cells ignoring error and text. like A1+B1+E1+F1+H1=300 or A1:H1=300 but errors and text or hidden column are being ignored and the formula can be applied to the rest of the rows by dragging down or copying. thank you so much for your response to this.

A1 B1 E1 F1 H1

1. #N/A WAIVED 100 WAIVED 200

2. 500 WAIVED 120 #N/A 50

Hi!

Please have a look at AGGREGATE function. I hope it’ll be helpful.

Using your example, I want the sum for Apples but only for January and March but then also removing the February.

Is that possible using sumproduct, please?

Please, anyone?

Hi!

Use data for January and March only

=SUMPRODUCT((C2:C10) * (A2:A10=H1) * (B2:B10=H2)) + SUMPRODUCT((E2:E10) * (A2:A10=H1) * (B2:B10=H2))

Thank you so very much!

This can also be done with sumifs, right? Just trying to understand if the results would be indifferent in case we use sumifs for summing non -adjacent columns with single or multiple criteria

Hi! I think in this case you can use the sum of the formulas SUMIFS.

Hi is there a way to make this exact formula dynamic though? for example if i have 12 months of data, i only want to sum up the month columns for apple, if the date range is less than or equal to june. and then for grapes i might wnt to see date range is less than or equal to august. and so forth for other fruits. i want to be able to drop the formula without having to manually indicate with columns to sum up to.

Hi! For the last example in the article above, you can add the month selection in cell H3. The column with the data of the desired month can be received with the INDEX function.

=SUMPRODUCT((INDEX(C2:E10,,MATCH($H$3,$C$1:$E$1,0))) * (A2:A10=H1) * (B2:B10=H2))

Great work done by you! thanks alot for the details topics covered very briefly. Keep it up and shared the valuable knowledge with community.

Greetings,

Is there a way to use SUMIF, SUMIFS or SUM(IF) searching the criteria in an array?

For example:

=SUMIF(B1:B10,A1:A4,C1:C10)

A B C D E F

1 ABC ABC 10

2 ABC BCD 25

3 XYZ CDE 30

4 DEF DEF 10

5 RST 20

6 DEF 10

7 GHI 15

8 TUV 20

9 BCD 30

10 CDE 10

The result of the example would be = C1+C2+C4+C6+C9+C10

My need for something like this is because in my spreadsheet my array of criteria have 70 values (for instance the 'B1:B4' in the above example is more like 'B1:B70'), and the sumrange have over 1000 lines.

Thank you all in advance!

Hello!

If I understand your task correctly, the following tutorial should help: Excel Advanced Filter - how to create and use.

Hi, I'd like to create a formula that multiplies data in pairs of cells if they're not blank:

The idea is for a cost sheet where there are 6 columns.

The choice is either hours and hourly cost OR number of days and daily rate OR an overall value which would just be multiplied by 1 for the total, then the total column at the end.

I've tried sum/sum if (honestly been working my way around the self-help guides) but I'm clueless and at best I am only able to add 2 columns together whereas I want them multiplied for a total cost.

Hours, Hourly Rate, Days, Daily Rate, Estimated Value, Total

5, 5, blank, blank, blank, total = 5x5

OR

Blank, blank, 10, 10, blank, total =10x10

OR

Blank, blank, blank, blank, 500, total = 500x1 (or just to copy the value entered in the estimated value cell)

Hope this is clear - it's the best I can explain without being able to add a screenshot or excel sheet.

Thanks in advance for any help! :)

Hi!

You can find the answer to your question in this article: How to multiply in Excel using PRODUCT function. I hope it’ll be helpful.

That's worked great, thank you! :)

Is there a chance to sum up the elements in column C in excel if the coordinates in columns A and B are repeated (at least once but maybe more)? So I mean a situation when it will be like this

A B C

0 1 4

0 1 2

0 1 3

0 2 3

....

Hello!

To calculate the sum of two criteria, use the SUMIFS function. If this is not what you wanted, please describe the problem in more detail.

=IF(COUNTIF(I5, "*mlg*"),H5/100000)COUNTIF(I5, "*grm*"),H5/1000))

I am new in excel. Please solved this issue. What is right formula.

Hi!

The following tutorial should help: Excel IF statement for partial text match (wildcard).

=IF(COUNTIF(I5, "*mlg*"),H5/100000, IF(COUNTIF(I5, "*grm*"),H5/1000,""))

Greeting to Ablebits team☺,

I am thankful to you all for such amazing & detailed explanation on excel topics and "also for providing the excel sheet".

But, In some of my previously read articles there are no excel sheets provided for practice.

I would request the team to provide excel example sheet for all the articles. If possible, then please add excel example sheets of previous articles also.

Feedback: -

1) Kindly add Excel practice sheet for each article.

2) Arrange all related topics sequentially.

Hi,

Anyone can help me what formula to use, basically I want to get the sum if date falls under Oct/22, Nov/22, Dec/22 and so on.

Appreciate your help. Thanks!

SKU 10/22/2022 10/29/2022 11/5/2022 11/12/2022 11/19/2022 11/26/2022 12/3/2022 12/10/2022 12/17/2022 12/24/2022 12/31/2022 1/7/2023 1/14/2023 1/21/2023 1/28/2023 2/4/2023 2/11/2023 2/18/2023 2/25/2023 3/4/2023 3/11/2023 3/18/2023

40015048001 0 0 0 0 0 0 100000 0 0 0 200000 0 0 0 0 200000 0

40015048002 0 0 50000 50000 50000 0 0 20000 20000 20000 50000 50000 50000 0 0 0 50000

40015048003 47300 40000 120000 60000 15000 0 0 0 0 0 19084 19084 19084 59358 59358 59358 59358

40015048004 78720 0 0 0 0 0 0 1324 0 0 19084 19084 19084 59358 59358 59358 59358

Hello!

If dates are written in the first column, I recommend reading this guide: How to use Excel SUMIF with dates. This should solve your task.

If the dates are written in the first row, try the SUMPRODUCT formula:

=SUMPRODUCT((B1:R1=DATEVALUE("22.10.2022"))*B2:R5)

I hope it’ll be helpful. If this is not what you wanted, please describe the problem in more detail.

The formula =SUM((C2:E10)*(--(A2:A10=H1))) doesn't work with me neither by pressing ENTER or CTRL+SHIFT+ENTER.

Hi!

The information you provided is not enough to understand your case and give you any advice, sorry.

Hi

How can I sum something like this:

WA11

100

250

WA9

3000

WA11

25

333

Just sum of all WA11, and they are all in same column?

Thanks

Hi!

To calculate the sum by condition, you need an additional column for this condition. Add column B. In cell B1, write

=A1.

In cell B2:

=IF(ISTEXT(A1),A1,IF(ISNUMBER(A2),B1,""))

Copy this formula down along the column. Then apply the SUMIF formula.

Thank you for your help.

Is possible to separate text only if they begin with asterisk * ?

Hi!

You can learn more about using asterisks in this article: Excel wildcard: find and replace, filter, use in formulas.

Feel a bit greedy to give away my personal findings, but "the time has come". Cool kids don't use SUMIF (no offence) while there is more elegant and practical way to aggregate data with the arrays. You described the idea very well, my comment is just for the execution. SUM(IF(A2:A10=H1, C2:E10)) and ctrl + shft+enter gives the same result but in a more intuitive way. And this logic is applicable to any aggregate function such as avg, median or count. Moreover, number of conditions has no limits as well. Lets say we want apples for Jan and Feb: SUM(IF(A2:A10=H1,IF(C1:E1 "Mar", C2:E10))) ctrl + shft+enter. This logic can be also implemented inside index - match, but that's another story...

Using the table above, how would I create the formula to find the total sales of Apples in the East during March, without creating values in the H column?

Thank you so much!

James

Hi!

If you don't want to use cell references in your formula, write those values directly in the formula. I hope I understand your question correctly.

I learned new thing to solve my problem today.

I am trying to sum values in an array if the condition is met. This array width is ever changing based on criteria.

I leave the setting of array width to later part as I did not succeed at the fixed width array too.

My data is set as Table in excel instead of range so that all formula grow together with the table when user add new data.

Here is my formula:

=SUMPRODUCT((RegByModel[[#All],[Jan-15]:[Mar-15]])*(--(RegByModel[[#All],[Model Name]]=Calculation!G81)))

It should sum all values in Table "RegByModel", column [Jan-15] to [Mar-15],

if the criteria in Table "RegByModel", column [Model Name] equals to "Calculation!G81" which is a text value.

If I break the formula into 2 parts, it works fine. But when I combine them into SUMPRODUCT formula, it gave #VALUE! error.

I tried using SUM formula too, same condition.

I use the function "Evaluate Formula" to check, it returns that the first part of the formula is causing error.

The first part of the formula is (RegByModel[[#All],[Jan-15]:[Mar-15]])

If anyone might have an idea on how to solve this, appreciate your input.

Thanks!

Hello!

In the SUMPRODUCT function, all ranges must be the same size. Each of them is a data column. You are trying to multiply two matrix which have different sizes.

Thanks for your quick reply Alexander!

Can I try to understand more which size is not same? Cell height or Width?

If I compare to the example =SUMPRODUCT((C2:E10) * (A2:A10=H1))

(C2:E10) = RegByModel[[#All],[Jan-15]:[Mar-15]] >> There is 3 columns in the example, and 3 columns in my formula. Each column denotes a month.

A2:A10 = RegByModel[[#All],[Model Name]] >> Single column for example and my formula.

H1 = Calculation!G81

Hope to get your further reply. Thanks.

Hi!

You cannot multiply 3 columns of C2:E10 by 1 column of A2:A10. This is mathematics.

Thanks Alexander for your kind help.

Think I need to break this intention into 2 steps.

This is very insightful. Pivot tables can also be used to get the required values. Though we have to update it if anything changes in the data set....Nice analysis, especially with the sumproduct and sum functions.

Please can the SUMIF with conditions return a blank cell?

Hi!

The SUMIF function returns a number. If nothing is found, it returns 0. You can replace zero with an empty value using the IF function.

For example,

=IF(SUMIF(B2:B10, F1, C2:C10) > 0,SUMIF(B2:B10, F1, C2:C10),"")

The writer of this article is the Hero we didn't know we needed.... Until we needed it.

I had a hell of a time Getting the Proper SUMIFS format after i needed to add a second Sum range.

Worked like a champ

=SUMIFS('Monthly Expenses'!D4:D27,'Monthly Expenses'!C4:C27,Values!E1) +SUMIFS('Monthly Savings'!C4:C10,'Monthly Savings'!B4:B10,Values!E1)

Thanks

Thank you, this article is my lifesaver. I spent hours and days trying a find a solution before stumbling upon this. :)

Very nice; very elegant. Thank you!

It's been years since I used Excel, and then only as an amateur.

Just wanted to point out that a possibly-hidden row (above or below) could have cells that each contain a simple SUMIF for their particular column. The grand total would simply sum horizontally across those cells.

I used something like this when I wanted cyclic period information that would expire after 'n' periods. Insert a new column between the titles and the previous period data, and you're off and running.

I've bookmarked this blog for future reference.