# Return the Questions Answered Incorrectly on a Quiz

#### joshnelsontn

##### New Member
Hello,

I have a test I've created for new hires, and I need to identify which questions are answered incorrectly based off an answer column.

 Question: Result: 1 correct 2 correct 3 wrong 4 correct 5 not answered 6 wrong 7 wrong 8 correct 9 correct 10 not answered

<tbody>
</tbody>
=INDEX(A:A,MATCH("wrong",B:B,0)) will return "3", but my desired output will be "3, 6, 7" (or something similiar).

Any ideas?

Thank you!!

#### Weazel

##### Well-known Member
maybe....

=IFERROR(INDEX(\$A\$1:\$A\$10,SMALL(IF(\$B\$1:\$B\$10="wrong",ROW(\$A\$1:\$A\$10)-ROW(\$A\$1)+1),ROWS(\$D\$1:D1))),"") control shift enter

assumes the question is in column A and the result is in column B

#### hiker95

##### Well-known Member
joshnelsontn,

<b>Note: Do not try and enter the {} manually yourself</b></td></tr></table><br />

Copy the array formula in cell D2 to range D3:D11

Last edited:

#### L. Howard

##### Well-known Member
Hi there,

Maybe either of these may suit.

First code you run and enter in the Input Box what answers you want listed in column F, "wrong", "correct" or "not answered"

The second code list all answers in columns E, F, G.

Regards,
Howard

Code:
``````Option Explicit

Sub WrongCorrectNoAns()

Dim myfind As String
Dim c As Range
[F:F].ClearContents
myfind = Application.InputBox(prompt:="Answers", Title:="Range Select", Type:=2)

For Each c In Range("B1:B" & Cells(Rows.Count, "A").End(xlUp).Row)
If c = myfind Then
c.Offset(0, -1).Copy Range("F" & Rows.Count).End(xlUp)(2)
End If
Next

End Sub

'//***************************

Dim myfind As String
Dim c As Range
Dim MyArr As Variant

[E:G].ClearContents

MyArr = Array("Correct", "Wrong", "Not answered")

Range("E1").Resize(, 3) = MyArr

For Each c In Range("B1:B" & Cells(Rows.Count, "A").End(xlUp).Row)
If c = "correct" Then
c.Offset(0, -1).Copy Range("E" & Rows.Count).End(xlUp)(2)
ElseIf c = "wrong" Then
c.Offset(0, -1).Copy Range("F" & Rows.Count).End(xlUp)(2)
ElseIf c = "not answered" Then
c.Offset(0, -1).Copy Range("G" & Rows.Count).End(xlUp)(2)
End If

Next

End Sub``````

1,081,676
Messages
5,360,441
Members
400,586
Latest member
Minty

### This Week's Hot Topics

• VBA (Userform)
Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
• List box that changes fill color
Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
• Remove duplicates and retain one. Cross-linked cases
Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
• VBA Copy and Paste With Duplicates
Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
• Macro
is it possible for a macro to run if the active cell value is different to the value above it
• IF DATE and TIME
I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...