1 of 2
help
excel-formula
asked 1 hour ago
ap kumar
1
Conditional formatting cannot change the value for another cell. So, this cannot work. Furthermore, you want
your result cell to change as an answer to the most recent cell value changed. So, if someone enters 0 into
B2 and directly afterwards into C2 the value -1 then your result cell should (if I understand correctly) reflect
only the incorrect value for C2. Hence, you'll have to make use of the Worksheet_Change event.
Alternatively, I'd suggest to create a complete error report of all the incorrect values on the sheet. Ralph 1
hour ago
thanks for your reply and suggestion @Ralph. how can i create a complete error report of all incorrect values
on sheet please guide me . thanks in advance. ap kumar 44 mins ago
You'll have to write the appropriate VBA code for that and then the check can be run whenever someone
presses a button to check all cells. This is how I'd do it: (1) copy all cells into a variable (array variable) in
VBA and then (2) loop through the array to check each cell if the value is correct or not. (3) If an error is
found then add a new sheet and start the error report (4) keeping track of all the errors using an error-counter
variable (5) possibly with automatic (clickable) links on the new sheet to automatically redirect to the cell with
the incorrect value. But that's just me. Ralph 40 mins ago
1 Answer
I don't know how much you know about VBA but it sounds like your best answer. Follow the
following steps and it'll do what you're asking for above:
1. Open a new workbook
2. Rename you first sheet "Tables"
3. Press Alt and F11 simultaneously
4. This will open the VBA window - double click on the "Sheet1 (Tables)" icon on the left had
side, as below - The large gray will turn to white, like mine:
5. Click anywhere on the large whit part and insert the below code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 1 Or Target.Column = 1 Then Exit Sub
If (Cells(1, Target.Column) * Cells(Target.Row, 1)) = Target.Value Then
With Target.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
Else
With Target.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 12632310
.TintAndShade = 0
.PatternTintAndShade = 0
6/27/2016 7:52 PM
how to return result of multiple cells into a fixed cell in excel - Stack Ove... http://stackoverflow.com/questions/38054226/how-to-return-result-of-mu...
2 of 2
End With
Application.EnableEvents = False
Range("AI9").Value = Cells(1, Target.Column) * Cells(Target.Row, 1)
Application.EnableEvents = True
End If
End Sub
6. Hit save (near the top-left) and close the VBA window
7. You tables should do what you want it to (and it you have multiple columns, it'll also work)
Note: If you want to change the cell where the correct answer gets put into (as apposed to AI9)
just change that bit with the "AI9" in the bottom part of my code.
I've run this on my own excel and it works perfect
answered 36 mins ago
Jeremy
21
Thanks Thanks Thank you so much @Jeremy you are a pro . works like charm . could you give me code to
analyze which tables i entered wrong while learning . It will be more helpful if you can tell me how to do it .I
can learn faster . Thanks again Jeremy ap kumar 56 secs ago edit
6/27/2016 7:52 PM