Excel Sumifs using numbers stored as text in criteria - excel

I am trying to use the SUMIFS() formula in excel to exclude certain rows from a table, but the criteria range includes numbers stored as text.
In the picture below I want to exclude the rows where entity id is "101000". The SUMIFS() formulas I have tried all provide the incorrect solution.
I found similar problems (here and here). This is where I came up with the SUMPRODUCT alternative.
I am trying to see if there is an alternative using SUMIFS. The syntax of SUMPRODUCT is confusing. But more importantly it doesn't work if I have entity id's that both translate to the same number value ('0100' and '00100').

If you are using Office 365 you can combined the FILTER and SUM functions.
First FILTER the amounts
=FILTER(C4:C9,B4:B9<>"01000")
Then SUM the filtered amounts
=SUM(FILTER(C4:C9,B4:B9<>"01000"))

You can sum the rows whose IDs do match, and then subtract it from the total sum:
=SUM($C$4:$C$6)-SUMIF($B$4:$B$6,"101000",$C$4:$C$6)

Related

Return a SUM from multiple sheets

I have a formula that returns values from multiple sheets under certain criteria and provides the sum.
=SUMPRODUCT(IFERROR(SUMIF(INDIRECT("'"&B17&" "&Year&"*'!C:C"),"Total",INDIRECT("'"&B17&" "&Year&"*'!Z:Z")),0))
I am looking to return a value that is correlated to Total, but since there are multiple Totals on each page I get back the sum of them all. I only need one Total (that is listed as 100%) from each sheet rather than all of them.
Linking spreadsheets is inherently fragile.
If you do it, then to minimise fragility:
use named ranges for your target cells.
bring them to your consolidating spreadsheet as single numbers - then sum them there.
=SUMPRODUCT(IFERROR(SUMIFS(INDIRECT("'"&B17&" "&Year&"*'!Z:Z"),INDIRECT("'"&B17&" "&Year&"*'!C:C"),B19,INDIRECT("'"&B17&" "&Year&"*'!AA:AA"),"100%")/COUNTIFS(INDIRECT("'"&B17&" "&Year&"*'!C:C"),B19,INDIRECT("'"&B17&" "&Year&"*'!AA:AA"),"100%"),0))
This is the solution I came up with. Changed to SUMIFS to make criteria more detailed searching for "Total" (which is B19) and "100%". Then divide by COUNTIFS using the same criteria as SUMIFS since each sheet has different amount of Total rows

Averaging data across multiple columns based on criteria (excel)

I have a spreadsheet (Office 365 Pro) that has numeric data in multiple columns. I want to average data in those columns if specific multiple criteria is met in other columns.
For example, one formula that is in use:
=AVERAGEIFS(K:K,C:C, ">=01/01/2021", C:C, "<=1/31/2021")
This formula works exactly the way I want, for the data specifically only in column K.
I want to accomplish what this formula does, but to include columns K through P, and not K only.
I tested a simple average formula which worked fine across multiple columns
=AVERAGE(K:P)
I can't figure out how to average data in all of those columns based on the criteria in my other formula.
If I simply change the column to average to:
=AVERAGEIFS(K:P,C:C, ">=01/01/2021", C:C, "<=1/31/2021")
I get a #VALUE error.
Any suggestions on how to accomplish this?
use FILTER:
=AVERAGE(FILTER(K:P,(C:C>=DATEVALUE("01/01/2021"))*(C:C<=DATEVALUE("1/31/2021"))))

Finding the sum of dates using first column value

So I am working in excel and have two columns, as shown below.
What I wish to do is to able to get the sum of yearly deadlines for A, B and C.
So that:
Get a sum of dates within Year 2020 for each Variable
Get a sum of dates within Month/Year for each specific A,B and C.
Currently, I have been using a long approach. I use a Vlookup for each row getting a filtered table for each Variable. Then using that I filter out Dates using combination of Countif and Countifs. But the problem with that approach is that I end up getting huge rows and table of data in the end increasing the file size.
I have also tried to use sumproduct() but I do not have numbers so I can not find a sum.
Is there a smart way of doing it using one formula?
Thank you.
Use SUMPRODUCT. For year/variable:
=SUMPRODUCT(($A$2:$A$13=E2)*(YEAR($B$2:$B$13)=$F$1))
for month/year/variable:
=SUMPRODUCT(($A$2:$A$13=$E2)*(YEAR($B$2:$B$13)=$F$1)*(MONTH($B$2:$B$13)=G$1))

Combining COUNTIFS with a VLOOKUP

I have looked through other posts on here and cannot find the solution I need.
I am currently using this formula:
=COUNTIFS(Tracking!$F$3:$XA$3,$F1,Tracking!$F4:$XA4,"~*")
This is counting all the * values that match to the reference "Attainment" (This is cell F1), but is relying on my 2 worksheets to have the people listed in exactly the same order. What I really want is the countif to calculate based on matching the person ID.
I have 2 sheets that use a unique ID for each person. I want to be able to match this ID and then run the countif, so in essence combine a VLOOKUP with the COUNTIFS. I did try adding another criteraia to the COUNTIFS but this doesn't seem to work. No IDs are repeated in either sheet. The unique ID defines each row and the row holds a very large amount of grade data for the person.
Sample Data
I think you could accomplish this using this formula in F3
=COUNTIF(INDIRECT("Tracking!"&MATCH(A3,Tracking!$A:$A,0)&":"&MATCH(A3,Tracking!$A:$A,0)),"*~*")
This is using the row number of the match to COUNTIFS any cells with a * in that row.

Returning sum of column for filtered data, without filter

I'm trying to calculate the sum of a column (TSQFT in the screenshot) that is part of a data set, which would be filtered based on multiple criteria using cell references (see screenshot). I don't want to use excel's regular filter as it's a hassle to change the settings and I'd like it to be done in a more automated way.
I've tried {SUMIF} and {SUMIFS} but those do not work as a filter - i.e. for a row to be {TRUE}, the numbers have to be in the same order as that specified in the criteria list {5-7-2} (see screenshot).
Would much appreciate any help.
You can try something like this:
Make 3 column of =IF(OR(C3=$C$10;C3=$D$10;C3=$E$10);1;0) formulas, one more column for a sum of this 3 column and a sumif based of the sum values
if the sum is 3 then the value is good.
This maybe the worst solution for this but as long as it can help, it can be developed into something better.

Resources