SUMIFS function doesn't match right - excel

Good afternoon,
I am having trouble with the sumifs function in Excel 2013. I have a huge sample of data with mostly numbers. I created a unique 'key' (simple added all the cells together: A1&B1 etc.). But if I use this key in the sumifs function as my criteria but Excel double counts some numbers. It looks like Excel cannot handle a very long criteria, the last numbers in the criteria are different but not according to Excel.
Number Code1 Code2 Amount Key
123456789 111111 111112 1 123456789111111111112
123456789 111111 111113 1 123456789111111111113
Above is a simplyfied version of my data. If I use the last column 'key' as the criteria in the sumifs formula the outcome is 2 instead of 1. Does anyone know how to fix this problem or which formula does the job?
Thanks in advance

Related

Count the maximum consecutive times a string appears in a column in excel

I have a column of data and I want to find the maximum number of times a string appears consecutively in it.
For example:
Adam
Adam
Adam
John
Alice
Alice
The output should be 3 here.
You can use a helper column and then resume data with Pivot Tables or formulas:
Sorting for this solution is critical or it won't work!
Formula in column B is:
=IF(A2=A1;B1+1;1)
This will output increasing count if name is the same. If not, it will restart count to 1.
Then you can use this with Pivot Tables or formulas to get max count for each name.
With Pivot Tables is easier, just drag field Name into rows section and Count into values section, but make sure you set it up to max instead of summing up.
Another option would be formula. You can use MAXIFS to get max count for each name. In case you don't have MAXIFS available because your Excel is old like mine, you can use the formula I've used in cell G17:
=SUMPRODUCT(MAX(--($A$2:$A$14=F17)*$B$2:$B$14))

Excel - Get unique count based on multiple columns (including date)

I'm trying to get a unique count of data in Column B that fall into the month of June (Column A date field)
Screenshot of Spreadsheet
I highlighted the rows that fall within June in Orange and the duplicate data in red to make it easier to view.
Count Total formula is a simple:
=COUNTA(A:A)-1
Unique Data formula is:
=SUMPRODUCT(1/COUNTIF(B2:B21,B2:B21))
Count June formula is:
=COUNTIFS(A:A,">=01/06/2020",A:A,"<30/6/2020")
But I can't figure out how get a count of unique data that falls within June (expected result is 13)
I've tried filter/unique formulas based on
Excel - Count unique values that meets multiple criteria
But I just can't get it to work. I know I could do it with VBA but this is part of a larger spreadsheet and every other part of the spreadsheet I've been able to do with Formulas, so would like to be able to do this last part with formulas too.
Anyone can help will be a life saver, it's been driving me nuts for the last couple hours.
In Excel 2016, which does not have the UNIQUE or FILTER functions, you can use this somewhat convoluted formula for a Unique count of June entries:
=SUM(IF(FREQUENCY(IF(LEN(IF(MONTH(Table1[Date])=6,Table1[Data],""))>0,MATCH(IF(MONTH(Table1[Date])=6,Table1[Data],""),IF(MONTH(Table1[Date])=6,Table1[Data],""),0),""),IF(LEN(IF(MONTH(Table1[Date])=6,Table1[Data],""))>0,MATCH(IF(MONTH(Table1[Date])=6,Table1[Data],""),IF(MONTH(Table1[Date])=6,Table1[Data],""),0),""))>0,1))
This part of the formula: IF(MONTH(Table1[Date])=6,Table1[Data],"") returns an array consisting of all of the June Data entries.
The LEN(... eliminates the resultant blanks
The Frequency function will then have us wind up with a count of 1 for each entry.
Then we just add it up.
Note that I used a Table and structured references, but you can convert it to regular addressing if you need to.
Of course, if you had Excel O365, you could use the simpler:
=COUNTA(UNIQUE(FILTER(Table1[Data],MONTH(Table1[Date])=6)))

Excel SUMPRODUCT w/ COUNTIF Between 2 Dates and 2nd Criteria

I have this formula:
=SUMPRODUCT((COUNTIF(A2:A1048576,ROW(INDIRECT(DATE(2019,1,1)&":"&DATE(2019,1,31))))>0)+0)
which will add up the unique occurrences between two dates. But I want to add a second criteria for a different column, lets say column "C" and it must contain lets say "TEST" in the cell. How would I modify this formula? I believe it uses COUNTIFS, but I can't seem to get the formula to work? Any help would be greatly appreciated! Thank you!
Date Quantity Notes
1/11/2019 2 OTHER Member Number Corrections
1/14/2019 7 TEST Member Number Corrections
1/14/2019 222 TEST Member Merges
1/15/2019 5 TEST Member Number Corrections
So the answer should be 2, they are both in January, 1/1/2019 - 1/31/2019 and they occurred on only two days, and the formula disregarded that there are blank cells at the bottom.

Excel Formula | Count all values that have the "keyword" in the adjacent cell in the row

This will be my first question on stackoverflow, I have done as much researching via google and this site but nothing I found relatable to this particular example. I attempted SUMIFS, VLOOKUP, etc.
This excel sheet will serve as donation tracker, each person will have their own row that goes from Jan-Dec. 1st sheet will serve as a tracker for the year, and the second sheet is where I want to the formula to tell me how much that person contributed via the 4 payment methods: Check, Cash, PayPal, and Facebook.
I'm having a hard time getting excel the formula to count the value for each type of payment in the row.
Here are snippets of my 2 sheets:
I would suggest a different format. There is no easy formula that will work with your current format. Sumif won't work with your format because the donation criteria is in the same row/column as the donation amount.
Example Format
Sheet 1 would be as follows: Column A-Month, Column B-Name, Column C-Donation Type, and Column D-Donation Amount. Column B is redundant, but is necessary with Sumifs. Sumifs allows you to have multiple criteria, but both criteria have to be the same size adjacent to the row/column you are summing. Column B can be hidden for a cleaner looking spreadsheet. Columns F-H represent sheet 2.
The formula in G2 is as follows: =sumifs(D:D,B:B,F2,C:C,G1)

Sum values in different rows if they match

I need some help regarding an issue that I was not able to solve. I tried to figure it out but without reaching my goal. This is what I have:
In sheet 1 I have estimated active customers for a period of time, where columns are months and rows are departments/states:
Sheet 1
Then, in sheet 2, I'm forecasting sales and need excel to return values from sheet 1 depending on which month we are kicking-off for each department:
Sheet 2
Of course, the kick-off month may vary for each department and values from sheet 1 should accommodate according to the selected month on column B in sheet 2.
And within C2:I4 I have used this formula:
=IFERROR(IF(C$1>=$B2,INDEX(Sheet1!$B$2:$F$4,MATCH($A2,Sheet1!$A$2:$A$4,0),MONTH(C$1)-MONTH($B2)+1),""),"")
The formula above actually works great when departments are not repeated in sheet 1 but, what would happen if departments are repeated (as shown in sheet 1) and I have to sum values from the same department and show the result on each cell in sheet 2?
I look forward to your kind help!
Thanks!
Try using SUMIF like this:
=IFERROR(IF(C$1>=$B2,SUMIF(Sheet1!$A$2:$A$4,$A2,INDEX(Sheet1!$B$2:$F$4,0,MONTH(C$1)-MONTH($B2)+1)),""),"")
Please try this formula, designed for your Sheet2!C2 cell.
=IFERROR(SUMIF(INDEX(Rodrigo,,1),$A2,INDEX(Rodrigo,,MONTH(C$1)-MONTH($B2)+1)),"")
In order for this formula to work you should declare a named range comprising of your range Sheet1!A2:F4. My formula calls the range Rodrigo. If you choose another name please change the name in the formula accordingly.
You can exclude zero results by adding a further IF condition to the formula. I would prefer to do that via cell formatting, like 0;0;; where the third semi-colon determines that a zero will not be shown. You can also suppress display of zeros for the entire sheet in the worksheet options.

Resources