SUMPRODUCT Circular error - excel

I'm having trouble with a simple excel formula. Here is a basic example :
I'm trying to sum all cells in B4:C7 when column A is not equal to B. If I set this formula in D1 for example this works well.
However If the formula is within the range B4:C7 on a line where column A is equal to B I get a circular error. The problem is there is no way my formula takes its own cell as it is on a line which colA = B. Excel calculates 0 as a result.
I know this example look silly. In my real problem all lines with A in col A won't execute the sumproduct because of various If conditions.
UPDATE
Here is a more precise example. The second tab displays what is correct. The formula is the same except for the ranges of the sumproduct that start from the line under the current one.
The formula is checking if some actual data was realized on the following month so as to start amortizing the budget after the last realized month.

Related

How can I automatically formulate a column while adding values ​to another? EXCEL

I have a column formulated in excel that returns all the business days from date X to today and it is automatically filled in, and there is a column to its right in which a COUNTIF formula is applied based on this first column , but the cells are not filled automatically as it happened before, but you have to drag down to complete the formulas, and I want this to be automatic too.
The first column is fulfilled with the following formula: =WORKDAY(MIN(Data\[Fecha_Completa\]-1);SEQUENCE(NETWORKDAYS(MIN(Data\[Fecha_Completa\]-1);MAX(Data\[Fecha_Completa\]-1)))), and the second one (which doesn´t fulfill automatically): =IF(COUNTIFS(Data\[Fecha_Completa\];A2)=0;A2;""); in which it is explained that, if the date of the first column is found in the database (Data[fechacompleta]), I want excel to return me nothing, but if it isn´t found, I want excel to return me the same date. Then the problem is that the second column isn´t fulfilled automatically at the same time as the first does.
As you may appreciate in the first image, the formula exists for that value, but once more dates are included in the database (as you may see in the second picture when we come to February) formula stop working and obliges me to drag it down.
I have tried to applicate the formula to the whole column but that isn´t what we are looking for as the file would be heavier.
To base a formula on a dynamically-spilled array, use a # in your range references. Therefore using A2# instead of A2 will automatically spill the formula to the same size as the formula in A2.
=IF(COUNTIFS(Data\[Fecha_Completa\];A2#)=0;A2#;"")

Excel formula to find last non blank cell in a column starting on a certain row

So I've got a column of data that I want to count the non blank cells after a certain row.
Here's an example of what I have:
So, in this example, I would like to start counting non blank cells in column A starting on row 13 (which would be a total of 4). If you look at the formula I have entered into cell D12 I can get the value I'm looking for with this formula:
=COUNTA(A:A)-11
I could use this formula:
=COUNTA(A13:A16)
but the point is the last cell with data in it can change due to entering different amounts of data in the column.
But I'm wondering if there is a different formula I could use that would count non blank cells from a certain row down regardless of the amount of data I enter into the column from a certain row down using an open ended range, kind of like this:
=COUNTA(A13:A)
This formula doesn't work but it kind of illustrates what I tried to do that didn't work.
from my comment above:
Well, you could always get the last used row dynamically and incorporate that, not sure what your benefit is over using the last row:
=COUNTA(A13:INDEX(A:A,LOOKUP(2,1/(A:A<>""),ROW(A:A))))
This makes it somewhat "open" ended I guess. Unfortunately it isn't GS =)

Excel - Time Intersection

I want Excel to check whether two time intervals intersects or not.
For example, I3-J3 and I5-J5 intersects.
How can I make Excel to show this intersection in another cell?
The following formula will reveal any interference for the last row. Just copy this formula into cell K3 and copy it down:
=IF(OR(AND(OR(I3>(I$2:I2)),OR(I3<(J$2:J2))),AND(OR(I3>(I$2:I2)),OR(I3<(J$2:J2)))),"interference","OK")
Note that this is an array formula which will have to be entered using Ctrl+ Shift + Enter. For more information on array formulas you might want to read the following article: https://support.office.com/en-us/article/Guidelines-and-examples-of-array-formulas-7D94A64E-3FF3-4686-9372-ECFD5CAA57C7
If you want to show interference for both rows then you'd have to expand upon I$2:I2 and J$2:J2 to include the entire list. So, this might be (for example) I$2:I$500 and J$2:J$500 respectively. Yet, you cannot include the row itself. Otherwise, you'd always get interference because the formula would check against itself. So, you'd have to generate individual formulas for each row and you cannot enter a generic formula and copy it down.
I am not sure how to show (with formulas only) the interfering entry. This is mostly due to the fact that there might be more than one interfering entry which would then have to be listed and separated by ,. I don't think that can be done with formulas only.
Note: the above solution is based on the basic principle that all dates and times in Excel are (essentially) just numbers formatted as dates or time. For more information you might want to read the following: Change date format using substitute or replace
So, the above formula is just checking if the date in column I is between any prior date in column I and column J. If the date in column I is > and prior date in column I and also < compared to the date in column J then this is an interference. The same has to be checked for the date in column K and then both have to be combined with an OR. That's the entire formula above.
Update:
Based on the comment provided by #Gordon the formula can be improved with the COUNTIFS function. Just enter the following formula into cell C2 and copy it down:
=SUM(COUNTIFS(A:A,"<"&A2,B:B,">"&A2),COUNTIFS(A:A,"<"&B2,B:B,">"&B2))
Any number greater than 0 means that there is at least one interference. With this formula it is now counting / showing multiple interferences as you can see in the following screenshot:
Note, that the improved formula does not require anymore for you to know the range of the table. Instead you can search the entire column A:A and B:B for interferences.

How to make a VLOOKUP formula conditional in Excel?

I've got a large Excel workbook with multiple worksheets and copious amounts of data. Every third sheet is an amalgam of the previous two sets. I've set up the following formula to pull the data from each worksheet, add it together, and present it in the third worksheet:
=SUM(VLOOKUP($A7,'worksheet 1'!$A:$F,2,FALSE)+VLOOKUP($A7,'worksheet 2'!$A:$F,2,FALSE))
This works as expected, unless the column A value is in one of the source worksheets but not the other. Then, I get the #N/A error with "Value not available."
What I want to do is make it so that, if the column A value is not present in the first worksheet, excel ignores that VLOOKUP request and simply pulls in the data from the second worksheet (and vice-versa for a value in the #2 but not #1).
If VLOOKUP isn't the appropriate tool to use, I can change it. I had an example sheet that I used to build this query, and that's how they put it together.
I am not an Excel expert and I've never used Access, so I'm learning as I go. Any assistance is appreciated!
Since you are using numbers, you could actually use multiple sumif statements.
I would suggest something like:
=SUM(SUMIF('worksheet 1'!$A:$A,$A7,'worksheet 1'!$B:$B), SUMIF('worksheet 2'!$A:$A,$A7,'worksheet 2'!$B:$B))
SUMIF is faster, won't look in the entire range, and if it does not find the value in A7, it will simply return 0.
I hope this helps.
UPDATE
Simple example. Say we have 2 sheets with a total column and we would like to get the value of that total cell:
you could sum 2 VLOOKUP forumale, or you could use SUMIF as follows:
=SUM(SUMIF(Sheet1!$A:$A,$A$7,Sheet1!$B:$B),SUMIF(Sheet2!$A:$A,$A$7,Sheet2!$B:$B))
The above is simply saying: Look for the value in cell A7 in the range $A:$A in sheet1 and return what's in the same row in the range $B:$B, and do the same in sheet2, then sum them both.
Note that SUMIF will actually sum all the resutls in a range, so if you have 2 totals in Sheet1!$A:$A then it will sum them both up. In a way this is the opposite of what VLOOKUP will do: it will stop once the first row containing the value is found. SUMIF won't stop.
The desired result in the example above is 208 and that's what you shall get.

Advanced Excel: Sum of relative cells of a category

I’m a designer. I have a list of tasks, with hours, and I’ve split them into milestones. I want to count the number of hours for each milestone.
Here’s a picture:
In other words: I want to look at the value in the M column, if it’s 1, I want to get the cell across it, then repeat down the rows, and sum the whole lot.
See if you can figure that one out with the least cell wastage! :) (This is Numbers for Mac, so no macros or vbscript or what-have-you.)
In Excel the SUMIF formula can be used.
Assumption: In picture above, the 'Hours' label is in cell A1
The formula for 'Milestone 1' in cell E2 would be:
=SUMIF($C2:$C11,RIGHT(E1,1),$A2:$A11)
The syntax of the formula is:
=SUMIF(range, criteria, sum range)
The criteria is determined by using the last character in the 'Milestone' heading.

Resources