Excel Formula Tally sheet - excel-formula

i was using a formula to tally the total of 28, when the user type done on remarks, it will increment finished and subtract value from remaining but i can't get it work, heres a link to the image preview
http://i.stack.imgur.com/1hJto.jpg
=IF(D9:D36="done",B4+1,IF(B$4=1,B$3-1))
please help

Instead of using an if statement and getting into CSE formulas and circular reference issues, which is where your formula is heading, use a COUNTIF function.
In your "Remaining" cell use the formula:
=COUNTIF(D3:D36, "<>" & "done")
This will calculate the number of cells in the D3:D36 range that are not equal "<>" to the word "done"
In your "Finished" cell use the foromula:
=COUNTIF(D3:D36, "done")

Related

How to do an if statement

This question is linked to Formula to remove every middle name in a cell in Excel.
I basically want to make an if else statement in excel. So the IFchecks if the cell is equal to "Gian" OR"Pier", if the condition is confirmed the formula proceeds to use this other formula
=IFERROR(LEFT(A2,FIND(" ",A2)-1),A2)
Sorry guys idk how to do it in an excel way. I can show you in for example in a Java or C way.
if(A2=="Pier" || A2=="Gian")
=IFERROR(LEFT(A2,FIND(" ",A2)-1),A2) \\the excel formula that deletes every second/third name if the cell
if formula in excel that checks a condition and if its verified it proceeds to use another excel formula
You could try the following as per your Excel Versions
• Formula used in cell B2
=IF(OR(TEXTBEFORE(A2&" "," ")={"Pier","Gian"}),A2,TEXTBEFORE(A2&" "," "))
Or, in cell C2
=IF(OR(LEFT(A2&" ",FIND(" ",A2&" ")-1)={"Pier","Gian"}),A2,LEFT(A2&" ",FIND(" ",A2&" ")-1))
Just adding the use of LET() which makes it simpler,
• Formula used in cell B2
=LET(x,TEXTBEFORE(A2&" "," "),IF(OR(x={"Pier","Gian"}),A2,x))
Or, Formula used in cell C2
=LET(x,LEFT(A2&" ",FIND(" ",A2&" ")-1),IF(OR(x={"Pier","Gian"}),A2,x))
Using MAP() to Spill as one dynamic array formula but the logic remains same.
• Formula used in cell D2
=MAP(A2:A6,LAMBDA(m,
LET(x,TEXTBEFORE(m&" "," "),
IF(OR(x={"Pier","Gian"}),m,x))))
you have to use the AND(...) and OR(..) for chaining logical conditions.
Here's an example

Excel Sumifs alternative criteria to "<>": How to check for non-blanks when the criteria range has formulas which can output nothing?

I've run into a strange issue.
When checking a criteria range against "<>", this does not seem to capture cells that contain formulas which output nothing.
For example, if a cell has the formula ="", then the "<>" criteria recognizes the cell contains a formula. So even though the string value is nothing, it's counted anyway.
The desired result for "<>" on the above example would be 0, but since the cell contains a formula (=""), the value for that row is counted.
Is there a criteria alternative to "<>" which can capture non-blanks, even if it's the result of a formula?
I know I could take a sum, and subtract the result of SUMIFS(A2:A3, C2:C3, ""). However in practice I'm writing extremely complex formulas (multiple lines for a single formula), so to apply this method would be to double the size of my already huge formulas, and throw readability out the window. It would be much simpler if I could simply add a functional criteria to my existing sumifs formula.
You could use a SUMPRODUCT:
=SUMPRODUCT(A2:A3,LEN(B2:B3)>0)
I just figured out a solution;
Instead of having the formula in the criteria range output nothing, have it output a single space:
=" "
Then, you can have the sumifs search against " " and "<> "

Unable to use SUBSTITUTE(ADDRESS(MATCH))) combination as a range in a LOOKUP function in Excel

I have an Excel sheet containing a matrix of [Year & Week number] in rows and [name of Employees] in row1 giving values of available weekly hours.
I am able to successfully use the Excel formula
=LOOKUP(2,1/((A:A=2018)*(B:B=31)),D:D)
at cell F2 for a reverse lookup. It gives the result 15 correctly.
However, I wanted to replace range D:D in the above formula to a dynamic range by identifying the column when the employee is known.
So I tried replacing by the formula
SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1","") &":"&SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1","")
This portion of the formula works and gives D:D for Employee2. This is shown to work in cell F4.
But the revised formula gives an error of #Value! at cell F6.
It says "A value used in the formula is of the wrong data type."
The revised formula which does not work is:
=LOOKUP(2,1/((A:A=2018)*(B:B=31)),SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1","") &":"&SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1",""))
I hope someone can help show me where I am making an error in trying to replace range D:D in the LOOKUP formula with the combination of SUBSTITUTE, ADDRESS & MATCH functions.
Thanks to all trying to help in advance.
You cannot just plug a string, which is what SUBSTITUTE returns into a formula.
You can use INDERICT to turn the string into a viable reference:
INDIRECT(SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1","") &":"&SUBSTITUTE(ADDRESS(1,MATCH("Employee2",1:1,0),4),"1",""))
But both INDIRECT and ADDRESS are volatile.
Use instead INDEX to return the correct column:
INDEX(A:AAA,0,MATCH("Employee2",1:1,0))
So your formula is:
=LOOKUP(2,1/((A:A=2018)*(B:B=31)),INDEX(A:AAA,0,MATCH("Employee2",1:1,0)))

Can we nest an IF inside a COUNTIFS in Excel?

I have been working on an attendance sheet and trying to make the monthly reports automatic. I have asked my previous question on the same issue and got the idea to accomplish the task.
But now I have stuck at one place. I have this below formula:
=COUNTIFS(C5:C27,">0", E5:E27,"G", F5:F27,"CAT1")
The value in cell "C" in the above is coming from the below formula (in cell "C")
=IF((COUNTIF(G5:AK5,"p"))>0,1,0)
I had to add this extra column ("C") only to supply input to my fist formula. My question is - "Can we merge the IF function inside the COUNTIFS to get the result in one go and to eliminate the use of an extra column (column C)"?
To perform these cell reference acrobatics you will likely need to switch to an array formula. Array formulas chew up calculation cycles logarithmically so it is good practise to narrow the referenced ranges to a minimum. A 'helper' column such as you've used in column C can generally reduce calculation cycles and make a worksheet more 'user friendly'.
A COUNTIFS function requires that the ranges being examined are not only the same size but also the same shape. Looking at G5:AK5 is not the same as looking at E5:E35 even though they contain the same number of cells¹.
In the sample data below, you formula is in A1 and uses the 'helper column' C. My array formula is in A2 and does not consider column C ahough it incorporated the logic.
        
The array formula in A2 is:
=SUM(IF(E5:E27 = "G", IF(F5:F27 = "CAT1", SIGN(COUNTIFS(OFFSET($G$5, ROW($1:$23)-1, 1, 1, 31), $I2)))))
Array formulas need to be finalized with Ctrl+Shift+Enter↵. Once entered into the first cell correctly, they can be filled or copied down or right just like any other formula.
¹Some functions not only accept but welcome cell ranges that are the same number of calls but transposed. Offsetting or staggering the ranges is also an option if the cell ranges are the same size. In difficult cases the TRANSPOSE function can be helpful.

Countifs dynamic date criteria

In a =COUNTIFS formula which I'm using, I am looking for data (specifically the number of granted patents) before and after a date. This date is listed in separate column and the last criteria in my COUNTIFS formula refers to this cell. However if I slide this formula downwards or sideways for my sample, the last criteria is not dynamic and keeps referring to the same cell (in the example: N2). How do I alter formula so that I can drag it downwards and sideways?
The current formula:
=COUNTIFS('1972-06-06 - 1988-01-12'!$E$2:$E$366963,'MA Acquiror Permno Cusip'!E2,'1972-06-06 - 1988-01-12'!$C$2:$C$366963,"<=N2")
I have tried a variant where the last criteria looks like:
"<=" & N2
yet this returns no hits, the previous formula does return hits but is not dynamic.
Thanks in advance for any help.
Just had this exact same problem and it took me an hour to figure out.
Apparently you need a space between the operator ("<") and the date.
"<= " & N2
^Should work. Notice the space after the equals sign.

Resources