Point value applied to choice from IF equation - excel

I'll try to do my best to explain the situation and what I'm working with.
I am working on creating a quiz within Excel 2010 and am trying to create a function that references another by assigning a point value when either Correct or Incorrect is generated by an existing formula. This is the formula I'm using right now for the quiz:
=IF(C4=Answers!B5,"Correct!","Incorrect")
I want to assign "1" to Correct and "0" to Incorrect and have that number add to a cell on a different sheet.
Any and all help is appreciated!

Using the function suggested by #Dave: If the answers are in ColumnC, your formulae in ColumnE and the correct answers in ColumnB of Sheet Answers then the Correct! results may be counted in the same sheet as the formula with:
=COUNTIF(E:E,"Correct!")

Related

In Excel which formula can write that would easily identify if my output condition is true or false

I am trying to do an excel formula calculated response in regards to comparing the values of three cells.
I have three cells and if one or more cell is populated with a value of greater than "0" I want it to return mix and if false ignore
Yes, actually you're correct you'll need to use COUNTIF or IF. The function IF should be good enough depending on your formula.
Please try to use the formula how I had in illustrated in my image. =IF(D3>TODAY(),"YES","NO"), your formula would be different depending on your values or if you're using dates.
If you're not using dates you can still just use IF plus the AND functions like this "=IF(AND(B3,C3,D3)<="","TRUE","FALSE")", see my linked file to see how I did it. Good luck!
Tip, you can check for "0"(a number) or ""(which means blank).
Check Value in 3 Cells for TRUE-FALSE example in excel.
Screenshot that might help understand how I use '=IF(AND...' Functions to do just what you originally asked.
To answer the revision to your question I would recommend referencing Microsofts resource on CONCAT function Combine text and numbers
Conversely, I've worked out an example for you. =IF(E4>0,(CONCAT("YES: B4:D4 ="," ",(TEXT(C4,"MM/DD/YY"))," + ",(TEXT(D4,"MM/DD/YY"))," + ",D4," Total Days")),"NO") which references my example screen shot here:
The use of "IF" plus the "CONCAT" function to return the mix of three or more cell values.

AGGREGATE formula not automatically calculating when written to results spreadsheet

I have a python 3.7 script that has been developed using the OPENPYXL (v2.5.10) library to take data from a number of excel workbooks, to process that data and then to write to a separate excel workbook. The results workbook contains around 100 named ranges and numerous formula which all work as expected including automatically calculating when the workbook is opened in excel.
I am having trouble with one particular formula group which includes the AGGREGATE function. In this case the formula writes to the results workbook, to the correct cell and in the correct form. While other formulas show the resulting value on opening the workbook, this sequence of formulas only show a result if you select the cell, place the cursor in the formula bar (as if you are editing the formula) and then you push the enter/return key. No change or edit is made to the formula. Once you have done this the formula works as expected.
I have tested this on both the latest macOS and windows versions of excel and I get the same behaviour. I should add that trying the 'calculate now', CtrlShiftAltF9, and 'calculate sheet' options do not have any impact. The only time the formula calculates is if you use the enter/return key.
The code that writes the formula is:
activeSheet.cell(row, col).value = f"=IFERROR(INDEX({rngData}, AGGREGATE(15,3,({rng}={cellRef})/({rng}={cellRef})*ROW({rng}),{nth}),{colIndex}),\"\")"
which gives, for example, a correct result in the excel workbook cell as:
=IFERROR(INDEX(_monthAgedDebt_Data, AGGREGATE(15,3,(_monthAgedDebt_ProjectNumbers=$L$4)/(_monthAgedDebt_ProjectNumbers=$L$4)*ROW(_monthAgedDebt_ProjectNumbers),1),6),"")
So in summary:
the code works as it writes the correct formula to the correct cell and in the correct form
in excel the formula does not automatically calculate but only works if you edit the formula in the cell, make no changes, and push enter/return to exit the edit
Is it an issue with AGGREGATE producing an array result? I chose this form of formula principally because you do not need a CTL-SHIFT-ENTER to make it work. If you enter it directly into a cell in excel you can enter it as a normal formula.
I haven't been able to find help on stack overflow other than this one. However, the solution proposed here doesn't work either.
This question poses a similar issue but has no relevant responses.
This question may hold a clue but I don't seem to be able to make that work as well.
Any thoughts on how to fix this issue appreciated. I am not sure if it is an openpyxl issue or an excel issue and am not sure what else to test.
All - the final answer for completeness.
It turns out that the key to solving this issue lay with OPENPYXL and that the guidance provided in the answer by Charlie Clark to this
question
was correct. I had initially applied the solution incorrectly.
I changed the formula to:
activeSheet.cell(row, col).value = \
f"=IFERROR(INDEX({rngData}, _xlfn.AGGREGATE(15,3,({rng}={cellRef})/({rng}={cellRef})*ROW({rng}),{nth}),{colIndex}),\"\")"
by adding in the '_xlfn.' to the front of the AGGREGATE function statement.
The excel spreadsheet now works as expected without the need to edit the cell containing the formula.

Dynamically extract a list of unique values from a column range in Excel?

I found this example in an excel tutorial
The following image is my desired result. and the following formula is supposed to be able to extract the unique records dynamically. I know how to do this with VBA but i really want to make this a formula without using a macro.
=IFERROR(INDEX($B$2:$B$9, MATCH(0,COUNTIF($D$1:D1, $B$2:$B$9), 0)),"")
I have tried the above formula as given in the example link above but it returns with error. I am assuming that this worked at some point in excel however it no longer works with Excel 2016. Can someone clarify why this formula no longer works? Thank you.
Answering my own question about 5 minutes later, so i read the patch nodes on the how match changed from excel 2008 to 2016. You need to use the index rather than the count.
=IFERROR(INDEX($B$2:$B$9, MATCH(0,INDEX(COUNTIF($D$1:D1,$B$2:$B$9),0,0),0)),"0)),"")")
Recommended edit to the formula to change the value returned on error to a blank:
=IFERROR(INDEX($B$2:$B$9, MATCH(0,INDEX(COUNTIF($D$1:D1,$B$2:$B$9),0,0),0)),"")

CELL("contents", ) in EXCEL

I have a cell (A1) in sheet 4 that is containing the following formula:
=CELL("contents",Sheet1!B61)
However, I want to find the content of the result. When I try to formulate it
=CELL("contents",A1)
The result is the same.
What I want to find is the content of =CELL("contents",Sheet1!B61). Is it possible to enclose it with a cell function twice? I've been trying to formulate it but there is always an error.
I cannot imagine a scenario in which it would be necessary to generate text strings representing cell addresses and then reference these in formulas. However:
=CELL("contents",INDIRECT(Sheet1!B61))
is what you require.
Regards
=CELL("contents",Sheet1!B61) is the same as =Sheet1!B61.
I think you are looking for INDIRECT which will translate a cell address given as text to the value contained in the cell.
=INDIRECT(Sheet1!B61)
Idk, try a nested CELL(CELL=(...)) not sure if it will work but...
Also, can you clarify exactly what you want? When you have
=CELL("contents",Sheet1!B61)
I assume the result is a number or text or whatever
Then you say, "I want to find the content of the result". What do you mean here? You want the cell (A1) in sheet 4 to display something other than the result of the formula above? If so, just change the formula. I think I'm a little lost here...

How to calculate/sum numbers in a single cell in excel?

Example:
In a single cell I want to calculate 10+20+30 and the answer should appear into the next adjacent cell.
Hope this helps in understanding the question.
Thanks In Advance.
The following thread will answer your question.
How to turn a string formula into a "real" formula
Check article pointed to in the answer by #iDevlop (not the accepted answer). EVALUATE function in a 'name' is probably the easiest way to go.
Edit:
Rough directions:
Create a new name (Eg. myResult) and associate its value to evaluating the cell your expression is to by typed in (Eg: assuming your text expression is in cell A1 of stylesheet Sheet1: =Evaluate(Sheet1!$A$1))
In the next cell (where you wish the result to be displayed), add a formula that simply evaluates the name you created (Eg: =myResult).
How you create a new name depends en the Excel version. On Excel 2010/2013: Formulas -> Name Manager -> Define Name. For older versions, refer to thread mentioned above.

Resources