Excel SUMIFS question: multiple criteria’s with AND? - excel

Novice Excel user here. I am trying to figure out to solve a bit of an Excel SUMIFS pickle. I am trying to total all the revenue of 8 cost centres from a particular revenue account with a particular description. The data has multiple cost-centres from different divisions, so that revenue would not assist with my reconciliation process.
So my question is, is there a way to add multiple criteria in one of the criteria boxes for example cost centre 2965 AND 1955 AND 2344 AND 3966 AND.... instead of doing it the way I have done below, which is so big and confusing:
“ =-SUMIFS($L:$L,$C:$C,Q11,$B:$B,$Y$6,$E:$E,"Fleet Distribution Revenue")+-SUMIFS($L:$L,$C:$C,Q11,$B:$B,$Y$7,$E:$E,"Fleet Distribution Revenue")+-SUMIFS($L:$L,$C:$C,Q11,$B:$B,$Y$8,$E:$E,"Fleet Distribution Revenue")+-SUMIFS($L:$L,$C:$C,Q11,$B:$B,$Y$9,$E:$E,"Fleet Distribution Revenue")+-SUMIFS($L:$L,$C:$C,Q11,$B:$B,$Y$10,$E:$E,"Fleet Distribution Revenue")+-SUMIFS($L:$L,$C:$C,Q11,$B:$B,$Y$11,$E:$E,"Fleet Distribution Revenue")+-SUMIFS($L:$L,$C:$C,Q11,$B:$B,$Y$12,$E:$E,"Fleet Distribution Revenue")+-SUMIFS($L:$L,$C:$C,Q11,$B:$B,$Y$13,$E:$E,"Fleet Distribution Revenue")”
The Cell Y is the reference to each of the eight cost centres, so I have to do the SUMIF 8 times, which is ridiculous. Is there a better way?

With classical Sumifs, you are using the correct approach.
If you have Office 365, you can use the new Filter() function, to filter the data with different criteria. AND logic is done with a * and OR logic is done with a + sign.
What you describe as "AND" is really "OR" logic, since a cell can only have one value.
Here is a simplified scenario:
=SUM(FILTER(A:A,((B:B=E2)+(B:B=E3)+(B:B=E4)+(B:B=E5)+(B:B=E6))*(C:C="x")))
In words: Sum all values from column A where column B is equal to either E2 OR E3 OR E4 OR E5 OR E6 and where column C is equal to x

Related

Sum values based on date compared to current date

I am currently trying to create an if statement that sums values based on whether a date has passed.
Excel example image
M1 to M12 dictate the months of the year e.g. 01/01/2021 for M1 and 01/12/2021 for M12
Now I want to create or use a formula that sums the values in row 4 based on what month we are currently in --> If we are currently in M1, e.g. 15/01/2021, then it only needs to sum the value in A4. However, if we are, for example, in M3 (28/03/2021) then it needs to sum A4 + B4 + C4
I tried using the following formula but the problem is that when it finds a value larger than 01/01/2021 it doesn't take other months into consideration anymore
=IF(TODAY()>=A2;A4;IF(TODAY()>=B2;SUM(A4:B4);0))
I added the zero at the end of the function to close the formula but my idea was to prolong it up til 12 months. However, it only ever sums the first cell (A4) because conditions have already been met. How do I 'overwrite' the first condition if more months have passed?
Any help would be greatly appreciated; I excuse myself for asking potentially dumb questions but Excel isn't my strong point and I am trying to learn.
Kind regards,
VHes
Try:
=SUM(INDEX(4:4,SEQUENCE(MONTH(TODAY()))))
An alternative approach using SUMIF:
=SUMIF(A2:L2,"<"&EOMONTH(TODAY(),0),A4:L4)
If SEQUENCE is not supported by your version of excel, (based on comments it does), you could also try the following:
=SUM(A4:INDEX(A4:L4,MONTH(TODAY())))
The trick here is that INDEX actually supplies a cell address, and displays the contents of that cell when needed.

Standard Deviation If Statement with drop-down list

Good Afternoon,
I'm creating a table which presents the average and standard deviations for a variety of metrics. This table can be filtered by date and location where the measures were taken. Thankfully, there is an AverageIf function, but there is no such function for standard deviation. This is my attempt:
{=STDEV.S(IF(**BPMS[Location]=$M$2**, IF(BPMS[Pre Date]>=$Q$1, IF(BPMS[Pre Date]<=$Q$2, BPMS[PRE Internalizing Raw], ""), ""), ""))}
M2 contains a drop-down list full of locations. One of those entries is an asterisk (*), which I would like to stand for any location. This works for the AverageIf formula, as * is usually a stand in for any value in excel formulas, but it's not working for the above formula. How can I write the formula to allow for a specific locations OR any location?
Thanks for the help!

Using Named Ranges in MS Excel

I have a data in Excel as shown in attached image where in I've used named ranges.
Spends. Apr18. May18. Jun18
Category A. 120. 120. 120
Category B. 135. 125. 129
Category C. 110. 111. 112
Name Range: Spends
Range: =Sheet1!$A$1:$D$4
The average quarterly spends are calculated using named references as:
=AVERAGE(INDEX(Spends,2,2):INDEX(Spends,2,4))
This returns 119 in Cell E2
How can I drag this formula to subsequent cells so that it is applied automatically.
If you use the INDEX function with constants, of course these constants will not change when you drag the formula down and/or across.
You will need to learn about absolute and relative references and use something like Row(A1) and/or Column(A1) instead of the constants 2 and 2.
But maybe it does not have to be that complicated.
You could just add a column in the data table that calculates the Average and refer to that cell.
Or, in cell E2, use the formula =average(B2:D2).
I don't see the need for the named range at all in this scenario. It only complicates things.
It seems that you are struggling with appropriate data architecture concepts rather than with using formulas.
If in doubt, keep it simple. I don't see an application for copying the formula across, since you only have three months of data and you want to average these three months.
If your real scenario has more columns, then, please!!, update your question and post more relevant context. Then post a comment, so I can see you made a change.
Again, since you are new here: do not post updates into comments. Edit your question and then post a comment.
Use the ROW() function to return the relative position
E.g. in E2 and drag down
=AVERAGE(INDEX(Spends,ROW(),2):INDEX(Spends,ROW(),4))
Maybe you want to dynamically find the quarter start and end columns then you can use Match function to find the dates and return the position (column) where found. Then feed these into your formula:
Getting the columns by searching for qtr start and end:
Referencing those found positions as column arguments in your formula:

EXCEL calculating average with OFFSET (coord unspecified) of a given keyword

Fun situation I'm trying to calculate. Basically in one row I have names of products, and the row to the right of it the number of days that have passed since the product was first received.
The calculation to do the days for ex is
=TODAY()-BB2
What I'm trying to do NOW, is identify let's say the product word "truck," and then calculate how many days on average the holding time of truck is.
I understand the logic of the formula I need, just not how to execute precisely. Basically the formula is going to need to use this average calculator with a keyword identified COUNTIF
=COUNTIF($A$2:$A$900,"TRUCK")/COUNTA($A$2:$A$900)
What I'm missing is some type of...IF "TRUCK, OFFSET (GIVEN CELL) -1)
Thanks for any thoughts!
-Wilson
A formula (in C1 in the example):
=AVERAGEIF(A:A,"truck",B:B)
should work but I would recommend a PivotTable for the additional functionality it provides:

Excel: Scalar product of two ranges

I am trying to find a proper way to calculate the scalar product of two ranges. For instance, the product of A1:A3 and B1:B3 would be A1*B1 + A2*B2 + A3*B3. Is there a good way to do this? Hardcoding this calculation is quite a tedious thing to do with large ranges.
Use this one
=SUMPRODUCT(A1:A3,B1:B3)
SUMPRODUCT formula – syntax and usage
Excel SUMPRODUCT formula - tutorialThe sum-product formula syntax is very simple. It takes 1 or more arrays of numbers and gets the sum of products of corresponding numbers.
The syntax is =SUMPRODUCT (list 1, list 2 ...)
Update on 11/30/2022
Considering the Excel Spill feature, now you can use SUM for most of the cases SUMPRODUCT was used, for example:
=SUM(A1:A3*B1:B3)
Here is the output:

Resources