SumIf varying criteria - excel

Is there a way to use the SumIf function on excel where the range criteria is not very specific? I have a column with variations of the same criteria, its a company's name but in my raw data the order of the words varies. I have one consistent and identifiable word I want to use in my formula as the criteria, but I'm not sure how to incorporate this to include every variation of the name - I keep getting error's

Related

Index Match Formula returns a VALUE error is look up cell has several characters

I am puzzled by this problem.
I have a matrix with different criteria (shown below) which is to be used by users to access themselves, with each piece of criteria reflecting a maturity level. The criteria and the relevant maturity level is stored within a sheet called MasterSheetGrid.
The user selects the option that represents the criteria that they believe they are currently a like, in column J. Column K then performs the follow formula
=INDEX(MasterSheetGrid!$5:$5,MATCH((XLOOKUP($J8,$5:$5,8:8)),INDEX(MasterSheetGrid!$1:$50,((MATCH($C8,MasterSheetGrid!$C:$C,0))))))
This formula attempts to look at the user selection in column J, and calculates the criteria that their selection equates to. Then, using the criteria, the formula should look up the criteria within the MAsterSheetGrid and then return the corresponding level from row 5:5.
This formula works and does what i want it to, however, there are some instances where the formula does not work, when the look up/maturity criteria has a large amount of characters. I cannot work out how many characters this is, but the formula does not work if over a certain amount.
Note, i have attempted to replace the XLOOKUP with INDEXMATCH with no luck, i receive the same error. Also, the maturity criteria/user selection is calculated by the formula below
=IF($C8="","",(FILTER(INDEX(MasterSheetGrid!$D:$I,MATCH($C8,MasterSheetGrid!$C:$C,0),0),INDEX(MasterSheetGrid!$D:$I,MATCH($C8,MasterSheetGrid!$C:$C,0),0)<>"")))
MaturitySheetGrid
Formula works correctly due to a small character look up criteria
Formula does not work when the look up/selected criteria has a large amount of characters

Excel Sumifs using numbers stored as text in criteria

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)

VBA equivalent to an index small function

Hi I have used this formula many times in excel but would like to be able to make a VBA code for it. Based off the criteria in a column "L" I would like to find the 1st and 2nd matches of name in a separate column G and add and subtract the corresponding values associated to that name (on the same rows) in different columns.
Formula: =IF(L3="1:1",INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($E$3:$E$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($F$3:$F$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($I$3:$I$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1)),IF(L3="2:2",INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))+INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),2))-INDEX($E$3:$E$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($F$3:$F$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($I$3:$I$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1)),"")
There may be a different way in VBA, this was working in the worksheet so far but got really long based of all the different criteria that could come up in column "L". My data set is about 4000 lines long with many different combinations
My data is as follows: and the expected answers are in column M using the above formula.

How to use SUMIF when there are multiple items in one cell?

I have two sheets in my sample Excel file:
Sheet1 is where I would like the SUMIFS function to sum up the number of employees associated with each company in the states that I've listed in a comma-separated list.
Sheet2 is where I've supplied the data broken up so that each row represents a company, a single state, and a number of employees.
The problem that I'm having is that I am unsure how I can break up a comma-separated listed of states so that I can use it as a criteria in my SUMIFS function.
I have tried doing this through Google Sheets using TRANSPOSE and SPLIT to create a vertical array, but that didn't work. I'm seeking help for this problem in Excel because that's where I primarily have to work in, but I am open to any ideas using GSheets.
Sheet1
Sheet2
Use SUMIFS wrapped in SUMPRODUCT and TRIM(MID()) to parse the string:
=SUMPRODUCT(SUMIFS(H:H,F:F,A2,G:G,TRIM(MID(SUBSTITUTE(B2,",",REPT(" ",99)),(ROW($XFD$1:INDEX($XFD:$XFD,LEN(B2)-LEN(SUBSTITUTE(B2,",",""))+1))-1)*99+1,99))))

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.

Resources