Excel SUMIFS function not returning results consistently - excel

I have a spreadsheet that I use to keep track of my checking account, budget and spending habits. I have a list of my financial transactions from my bank that I put in a table that looks like this (All dates and amounts are random):
I populate a budget chart and table that looks something like this:
For awhile, I've been manually changing the fill of the Category tabs and manually populating the budget table. However, I realized that by adding conditional format rules that change the fill and text color based on specific text in a cell, I can add text like "Housing" or "Automotive" to the Category column and it would not only manually change the fill for me but it would also allow me to automatically populate the budget table. I tried using the SUMIFS function to do this.
Here's the way I tried to implement the SUMIFS function in the "Housing" cell for January in the Budget Table:
=SUMIFS('Sheet 1'!$D$2:$D$1000, 'Sheet 1'!$A$2:$A$1000, $A4, 'Sheet 1'!$B$2:$B$1000, ">01/01/2016", 'Sheet 1'!$B$2:$B$1000, "<01/31/2016")
This works for January and May, but when I use the same formula for February:
=SUMIFS('Sheet 1'!$D$2:$D$1000, 'Sheet 1'!$A$2:$A$1000, $A4, 'Sheet 1'!$B$2:$B$1000, ">02/01/2016", 'Sheet 1'!$B$2:$B$1000, "<02/29/2016")
It returns a value of 0 to the column. It does this for all other months. Any idea why this formula might not be working for me?
EDIT: Incase my forumla wasn't clear, I wanted to provide a break down. The SUMIFS formula is supposed to be summing all values in the Amount column (the 2:1000 is to have enough of an area to look for that it will cover a year of my regular updates to this table without having to update the search area) that fall into the specified criteria. Those criteria being the text "Housing" being in the "Category" column (which is following the conditional formatting rules so fill and text color are changed) and the value falls into the range of dates provided.

Replacing:
< with <= and > with >=
will bring your values into the correct range

Related

Existing array formula, need to add date restriction

I have been tailoring an excel sheet for budget analysis using a pivot table.
Works quite well actually!
One of the fields I have above the table is a reporting of the 1st, 2nd and (depending on the schedule the 3rd) pay check in a month.
Right now I am using this formula:
1st
=INDEX(bk_download!$D$2:$D$200, SMALL(IF(bk_download!$B$2:$B$200="DFAS-CLEVELAND FED SALARY ***********xxxx", ROW(bk_download!$B$2:$B$200)-ROW(INDEX(bk_download!$B$2:$B$200,1,1))+1),1))
2nd
=INDEX(bk_download!$D$2:$D$200, SMALL(IF(bk_download!$B$2:$B$200="DFAS-CLEVELAND FED SALARY ***********xxxx", ROW(bk_download!$B$2:$B$200)-ROW(INDEX(bk_download!$B$2:$B$200,1,1))+1),2))
3rd
=INDEX(bk_download!$D$2:$D$200, SMALL(IF(bk_download!$B$2:$B$200="DFAS-CLEVELAND FED SALARY ***********xxxx", ROW(bk_download!$B$2:$B$200)-ROW(INDEX(bk_download!$B$2:$B$200,1,1))+1),3))
As you can see in the formula, it's referencing another sheet in the file. What I am trying to do is move the source data to a whole separate file that will be a continuous dump of our bank statements. I've successfully pointed the pivot table source to the new file and it's pulling everything in fine, then applying a date filter for the table for whichever month we're on (set manually).
The catch with this formula I pasted is it works great for finding the 1st, 2nd and 3rd occurrence of the specified keywords, but of course only if a months worth of data is in the sheet.
How would this be changed to allow a date filter?
I.e cells A1 and B2 would be 5/1/18 and 5/31/18, use those two cells to define what the formula should look within to return the needed result.
EDIT: New formula. AND doesn't behave that way with array formulas.
Just add the date conditions to your IF statement. Say your dates in bk_download were in column A and your filter dates were in A1 and B1, this should work for the first formula:
=IFERROR(INDEX($D$2:$D$32, SMALL(IF(($B$2:$B$32="DFAS-CLEVELAND FED SALARY ***********xxxx")+($A$2:$A$32<=$B$1)+($A$2:$A$32>=$A$1)=3, ROW($B$2:$B$32)-ROW(INDEX($B$2:$B$32,1,1))+1),1)),"None")
Change "None" to whatever value/message you want when nothing is found.

Generate or fill cell data based on another dataset excel

I've a data set that shows;
employee name
date
time work started
time work ended
Now I am trying to have a report like sheet where I can select a certain employee name from a list of employees to view his/her time attended for a particular month.
I tried vlookup but went no where since I need to lookup by two columns plus a row.
Is this possible? without macros or vba.
Thanks
Since name and date are unique identifiers it is possible to use the sumifs function.
For ‘time in’ and ‘Rachel’ this will look as follows:
=Sumifs(column ‘time in’ from data set, column ‘name’ from dataset, “Rachel”, column ‘date’ from data set, “10/01/2017”)
Where Rachel and the date also can be a referenced cell.
=AGGREGATE(15,6,ROW(SHEET1!$A$2:$E$22)/((SHEET2!$B$1=SHEET1!$B$2:$B$22)*(SHEET2!$A4=SHEET1!$C$2:$C$22)),1)
The above formula will grab the row number that matches your criteria. to pull the information you want, you can place the row number inside an INDEX formula to get the following:
=INDEX(SHEET1!$D:$E,AGGREGATE(15,6,ROW(SHEET1!$A$2:$E$22)/((SHEET2!$B$1=SHEET1!$B$2:$B$22)*(SHEET2!$A4=SHEET1!$C$2:$C$22)),1),COLUMN(A1))
You can place the above in your first Time cell and copy right and down. You will see errors if criteria do not exist. ie no person of that name or no date data for that person. to avoid this you can wrap the whole thing in an IFERROR like the below:
=IFERROR(INDEX(SHEET1!$D:$E,AGGREGATE(15,6,ROW(SHEET1!$A$2:$E$22)/((SHEET2!$B$1=SHEET1!$B$2:$B$22)*(SHEET2!$A4=SHEET1!$C$2:$C$22)),1),COLUMN(A1)),"Nothing found")
if you would rather a blank than nothing found display change the "nothing found" to "" or 0 if you want 0 to be displayed.
Note: Aggregate is performing array like calculations in this case. As such you do not want to full column references as it will cause a lot of unnecessary calculations to be performed. Because you have unique entries, SUMIFS option given in another answer is a much better choice.
I think a pivot table will do the job for you.
Place the employee name in the filter, place date and
times in the rows.
Remove subtotals from the Pivot Table
Change Table layout to tabular and Repeat rows
Right click on the Time In and select Ungroup
Then you have the image below.
I have the following layout:
In B11 write this formula and drag down:
=INDEX($B$2:$E$5,MATCH($B$7&$A11,$B$2:$B$5&$C$2:$C$5,0),3)
In C11 write this and drag down:
=INDEX($B$2:$E$5,MATCH($B$7&$A11,$B$2:$B$5&$C$2:$C$5,0),4)
Note that these are Array-Formulas, so you need to enter them with CTRL + SHIFT + ENTER instead of the normal Enter.
You will get a #NV error if the employee hasn't worked on one of the dates A11 and A12. So you could surround the Formula with IFERROR to avoid this.

Excel - to format the data in a more readable way

Is it possible to get the above table in a format such as the table below, in a much easier manner without having to do a brute force approach of creating 9 columns for the LTV band and assigning it a PD value in the table?
Excel... Insert Pivot table
Select range and fill in as layed out in image below.
you can hide grand totals if you want by right clicking on the pivot table and selecting Pivot table options then the totals & filters
There are many other features as well but this gives you the general idea.
As to missing LTV values, you just need blank rows for each value so the chart pivots on all the data.
OK, Here's an idea
You can do what you want using a complicated index formula that checks the Year and the Month and other number but it's quite complicated, so.
Use a formula to create an ID column to the left of your data and you can use a fairly simple vlookup to extract the data.
The ID will be the YEAR + MONTH + B + I.TV number. On my sheet the formula is.
=C2&D2&"B"&E2
Next create your new table by listing the Years and Months and entering in the headings B1 to B9. Then put your vlookup in the first cell under B1.
=iferror(vlookup($A12&$B12&C$11,$B$2:$F$9,5,false),"")
It's not too complicated, $A12&$B12&C$11 builds the ID we want to search for using the Year, Month and Heading B1 cells. Pay attention to the way the cell references are locked as that allows you to autofill across and down while still referencing the headings etc. $B$2:$F$9 is the range you want to use for the vlookup and 5 is the column with the data you want to return.
Have a look at my example below.

Formula to reference data from a PivotTable

I am having some difficulty writing a specific Excel formula. I have a summary sheet that pulls data from various other sheets extracted from a database. One of these is a PivotTable whereby using the Item Number in the first column and the dates along the top row as a reference I can pinpoint the data I need. eg:
To address the highlighted cell I would normally manually write:
=GETPIVOTDATA(HighPiv,"SPN010977-204 11333")
HighPiv is the name I gave to the pivot table as I am referring to it from my summary sheet.
This works, however the Week numbers along the top will continuously be changing in the pivot every month and therefore this formula will not pick up the values accurately once the pivot is updated. I have been looking into a way to make the referencing more dynamic. This is the summary where the data is required:
Rather than within the quotation marks of the formula (adding the specific Item number and Week number word for word), I was hoping to refer to the cell references of the summary sheet. (So if I wanted Item number, say A55, and Week number, say H50). The dates in the summary sheet change according to the pivot so referring to the dates on the summaries to get the data would be a better way for it to be kept up-to-date.
The problem here is I don't know how to go about it. I have tired to refer to the cells in question but it doesn't seem to work giving me #REF! or #VALUE! errors.
I think what you would like is:
=GETPIVOTDATA("Qty",HighPiv,"Item",A55,"Week",H50)
I find the easiest way to write such a formula is to start by ensuring that Pivot Table Tools > Options > PivotTable – Options, Generate GetPivotData is checked then in the desired cell enter = and select the required entry from the PT (here63). That would show (for example) “SPN010977-204” and 11333 or ”11333” but these can be changed to A55 and H50.

Excel Advanced Filtering Issues - Advice Needed

So basically I have a main table, and I want to filter that data to another table (normally easy) but I want this based upon 2 criteria. e.g. I want to filter the data of a specific department but only for the current month. The way I display the current month in the main table is by inserting the date from a userform and then by formatting that cell to just display the month. However, when using advanced filter I use the column headings that I want to filter e.g. department: mens, month: november (worked out using =now() then formatting to just display the month) but when I'm running the filter it's not picking out the information at all.
I think this lies with the way the month is worked out and displayed but I can't figure out another way to do this. Any help is greatly appreciated.
I'm also open to trying a new method of just selecting data for the current month if anyone has a cleaner way, as I'm sure there is one.
You have to use a formula in your criteria to specify what month you want to extract. But it's not terribly intuitive. Take a look at this sample. My starting list is the range A1:B7. My criteria is in range D1:E2. The Department is straightforward; I just entered "3". (Obviously, without the quotes.) But instead of a Month criteria, I added "GetMonth" and entered the formula shown in the formula bar. You can name this whatever you want, but it can't be the same as one of the headers in your source list. (Yeah, I checked.) The formula checks to see if the current month of the date in cell B2 is 12, which is December, and returns TRUE or FALSE. You could use 11 for November. The advanced filter will apply the reference to cell B2 that's in the formula in a relative fashion to all cells in the Month column. And Viola! my output in range A10:B11 is what you'd expect it to be.

Resources