Excel Formula for SUMIFS for calculated date range - excel-formula

I've setup a family budget/cashflow and I'm trying to write a formula so I can look at particular weekly periods and see how well we've tracked in terms of savings.
Essentially I have a process date column, a number of columns for the transactions in our various accounts.
At each pay I'd like to look at the sum of all the accounts for the past 7 days to see if we've spent more than the pay or not.
I thought I could use SUMIFS to do this based upon the research I've done. I have the following formula but Excel complains it has an error and I don't know where?
Any help is appreciated!
SUMIFS(Table1[[Savings Amount]:[Holiday Savings]],[Process Date], ">" Table1[[#This Row],[Process Date]]-7, [Process Date],"<=" Table1[[#This Row],[Process Date]])

This might get you the results you would like but it is horrible and I'm afraid I have not attempted to simplify it because I am not sure it meets your requirement, though I hope it may be some help with the syntax:
=SUMIFS([Savings Amount],[Process Date],"<="&Table1[[#This Row],[Process Date]])+SUMIFS([Holiday Savings],[Process Date],"<="&Table1[[#This Row],[Process Date]])-SUMIFS([Savings Amount],[Process Date],"<"&Table1[[#This Row],[Process Date]]-6)-SUMIFS([Holiday Savings],[Process Date],"<"&Table1[[#This Row],[Process Date]]-6)

Related

Excel 365: COUNTIFS with range as a criteria to lookup

[as per the comments, I am happy to provide a minimal example of the problem if someone can tell me how to upload excel to stack overflow!]
I had a look at previous answers, but nothing seems to fit. Once answer nearly did, but I can't adapt it. Trying to steer clear of VBA but please tell me if needs must.
Basically, I have a large-ish sheet of incident tickets. Some are logged by company A, and some by company B. Unfortunately, the only way to tell which company has logged which ticket is to search in another table on name. What I am trying to do is count tickets that match certain criteria that were logged by, let's say, company B - I have the list of people at company B in a worksheet in the workbook
Obviously, COUNTIFS seems to be the obvious answer, except I can't seem to get a sensible answer from COUNTIFS. :) So, I can get a perfect number of tickets for this or that criterion, but I am unable to add that the ticket should be from company B only, ie: I need a COUNTIFS('Ticket'!$D:$D,'CoBPeople'!$N:$N) term, and I don't see how that's possible to include. In VB, I would know which thing I am iterating over and check each time (inefficient, I know, but we're talking thousands here, not millions!) and just add them up, but it doesn't seem to be possible to get COUNTIFS to "lookup" each name it finds as it does its thing.
Any ideas? I just feels like there is an obvious answer I am missing...
Thanks in advance!
MrBB.
I was hoping to be able to do tis without modifying the ticket dump, but adding a column that checks which company a person works for does look like that's the easiest solution.

How do I display text based on a condition?

I feel like I'm missing something here but can't find out what. I'm creating a planning template. I want a separate table in which the user can put the deadline name with the deadline week.
In my planning overview I want these deadlines to appear. To do this, I tried an approach with IF()-statements. Although this works well, it doesn't deal with a new deadline that is added later on in the project.
I could brute force this and create 30 IF()-statements so there's space for 30 deadlines (which is more than enough) but I have a feeling this can be done in a much smoother way. Do you have any suggestions for this?
You can use INDEX/MATCH:
=IFERROR(INDEX($A:$A;MATCH(E2;$B:$B;0));"")
looks like you have not used the function vlookup before.
Vlookup is one of essential functions in excel and learning & starting use of it will definitely make you a better excel user and save you lots of time later on.
You can solve your puzzle via vlookup as described below:
Swap the columns "name" & "week". Week will be in col A, Concept in col B.
Write this formula to cell E1 and then you can paste it to F1 to N1:
=IFERROR(VLOOKUP(E$2;$A$2:$B$50;2;FALSE);"")

Simplifiy and make an more efficient Excel Formula

I have been continually adding in complexity to my formulas to accomodate the large amount of data. I have been trying to simplify this excel formula but cannot seem to find a way that works well. I would appreciate any advice!
{=IFERROR(IF(INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),4)="Complete",INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2),IF(VLOOKUP([#SN],FullSNList_2,8,FALSE)="None",IF(ISNUMBER(MATCH(SUBSTITUTE(TRIM(M4),"`",""),TRIM($L4:L4),0)),INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&"` ",INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&" "),IF(OR(VLOOKUP([#SN],FullSNList_2,8,FALSE)="Dev",VLOOKUP([#SN],FullSNList_2,8,FALSE)="ECO",VLOOKUP([#SN],FullSNList_2,8,FALSE)="Rework"),IF(ISNUMBER(MATCH(SUBSTITUTE(TRIM(M4),"`",""),TRIM($L4:L4),0)),INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&"` ",INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&" "),IF(ISNUMBER(MATCH(SUBSTITUTE(TRIM(M4),"`",""),TRIM($L4:L4),0)),INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&"` ",INDEX(FullFlow_2,SMALL(IF(FullFlow_2[SN]=[#SN],ROW(FullFlow_2[SN])-ROW(INDEX(FullFlow_2[SN],1,1))+1),COLUMN(M$2)-COLUMN($L$2)),2)&" ")))),"_")}
A little more info on the code. It is meant to scan a table and search for a step name (DOC###). Depending on other criteria's (if one column has none, rework, or broke, in it) spaces are added to the end to differentiate between them while being able to still be counted at a later step. Also, if a step is being done for the 2nd time, a period will be added afterwards.
I have been putting the formula in http://excelformulabeautifier.com/ to help read it a bit easier!
UPDATE: I have Modified the formula a bit and added explanations. The new code has replaced the old one in the body. I have attached pictures to show my explanation.
Formula Explanation PG 1
Formula Explanation PG 2
Example Data output
NOTES: In order for this to work for me, due to the circular references, I turned on Iterative Calculations and set the Max iterations to 2.
Removing the VLookups from the formula made the calculation time a lot shorter! Thank you all for your ideas! Any other suggestions are greatly appreciated!

Excel: CountIf Quandry

Thanks for your help in advance!
So my problem is the following; I have a sheet which I use to log risks that come up in my project. They are graded from Critical to Low, and are either "Open" or "Closed". I want a formula that will count only the open actions which are critical. So far i've got =COUNTIF(Risks!E:E,"Critical"), which correctly counts the number of critical risks, but obviously doesn't take into account if they are open or closed. I tried using än IF statement at the start, but found that =IF(Risks!H:H="Open",COUNTIF(Risks!E:E,"Critical")) wasn't really returning what I needed.
I definitely remember getting this to work before, but I'm thinking perhaps I used VBA? Been a while since I've used excel!
Any help much appreciated!
Ed
Use COUNTIFS():
=COUNTIFS(Risks!E:E,"Critical",Risks!H:H,"Open")
COUNTIFS() allows the use of multiple criteria.

MS Excel IF statement confusion

I'm trying to make a spreadsheet for some calendars that I'm selling. I have a pricing scheme which depends on how many calendars a customer buys. I want to be able to keep track of sales, but I don't want to have to input the price per unit for each sale. I set up an IF statement that seems to work except for the last variable. Here's a screenshot:
As you can see, it works all the way to the last one. After the number reaches 11, the price per unit should drop to 6, but it doesn't! I know it must be a simple fix, but I don't know much about IF statement, so I'm stuck. Please help!
If you set up your price table similar to my set-up below, you can use a VLOOKUP formula to make it more flexible.
The formula in H10 is:
=VLOOKUP(G10,$B$1:$C$5,2,TRUE)
Enter and drag down.
The benefit of this approach is that you can change the lower bound count on the left and you'll get an adjustment without having to update the formula. Try changing the 2 in Count to 3 and you'll see the adjustments right away.
An added benefit is you can add some more values to the table for further pricing brackets.
If you must use an IF statement, try:
=IF(G10=1,9,IF(G10<=5,8,IF(AND(G10>5, G10<11),7,IF(G10>=11,6,IF(G10="","")))))
The problem with yours is it will never read the if(G10>=11 part because it has already evaluated if(G10>5
If it should have no output when G10 is blank, use the following variant:
=IF(ISBLANK(G10),"",IF(G10=1,9,IF(G10<=5,8,IF(AND(G10>5, G10<11),7,IF(G10>=11,6,IF(G10="",""))))))
I agree with #Nanashi that putting the price thresholds in a separate table and using vlookup is a better solution. That would make it possible to change the price points without having to edit multiple formulae.
But to just get your formula working, try this: =if(g10="","",if(g10=1,9,if(g1<=6,8,if(g10<=10,7,6))))
Notice that:
You don't need (and probably don't want) quotes around your numeric
values
The order of tests is important. In your original, the test for g10>=11 is never reached because it is in the else part of the g10>5 function.
A properly constructed table of quantities and pricing coupled with a VLOOKUP formula would be the best way to go and eases future pricing changes. But for the sake of diversity, your straightforward pricing structure could also be handled by the following:
=(6+(G10<11)+(G10<6)+(G10<2))*(G10>0)
In the formula, "G10>5" should be "G10<=10". Otherwise, when it gets to 11, it still meets the G10>5 criteria.

Resources