Solved

Expanding my IF statement

Posted on 2014-07-10
116 Views
Folks,
Below you will see in the formula bar an IF statement that is not getting what I would like.
My objective is this:
If there's a #DIV/0! error in cell O6, in cell P6 I would like to do this:
Replace the #DIV/0! in cell O6 with "Error" and in P6 have a remark saying "Please refer to Remarks". If no #DIV/0! error in O6 then in P6 have a remark saying "OK"
0
Question by:Frank Freese

LVL 21

Accepted Solution

The first part should be:
=IFERROR(AVERAGE(N6:N10),"Error")

Try that and see if returns what your looking for
0

LVL 33

Expert Comment

You can't use a formula to place a value in another cell.
0

LVL 21

Assisted Solution

Ok and for the 2nd part in P6 place
0

LVL 13

Assisted Solution

IFERROR(AVERAGE(N6:N10),"ERROR")  putting on cell O6

and

IF (O6="ERROR","please refer to remark","OK") putting on cell P6

Duncan
0

Author Comment

I think you all got it!
0

Author Closing Comment

great job...thank you
0

LVL 13

Expert Comment

Have a nice day

Duncan
0

Author Comment

My pleasure, however, I spoke a little early. I'm having a problem still but haven't figured out how to solve it yet
0

LVL 44

Expert Comment

Try this formula
=IF(OR(O6="",O6=0), " ", IF(O6=AVERAGE(N6:N10),"Correct","Incorrect"))
0

Author Comment

You're a good man Martin. This problem was just solved with my last post. I've decided to move away from the Correct/Incorrect.
However, I was preparing another post to you regarding printing we spoke of the other day.
0

LVL 44

Expert Comment

Consider changing your Worksheet_Activate events to something like this (for the AVERAGE sheet).
Private Sub Worksheet_Activate()
With Worksheets("Average")
.Range("O6").ClearContents
.Range("N6") = 8
.Range("N7") = 7
.Range("N8") = 9
.Range("N9") = 6
.Range("N10") = 10
End With
ActiveSheet.Range("O6").Select
End Sub

0

LVL 44

Expert Comment

And instead of putting that code in the Activate event and the TryAgain sub change the Activate event to
Private Sub Worksheet_Activate()
TryAgain
ActiveSheet.Range("O6").Select
End Sub

0

Author Comment

I accepted the second post, at this time.
0

LVL 44

Expert Comment

I know. My last two posts are just suggestions about what you could do when refreshing the sheet so that the data you put there would show up again after the user fooled around, left the sheet and came back, or clicked the TryAgain button. If however you were going to leave N6:N10 blank then my suggestions don't apply and in that case you might as well get rid of the TryAgain buttons.
0

Author Comment

OK...now I understand and  I like the idea of first providing data they can work with. I think I'll keep the Try Again forcing them to reenter the formula (of course they could simply change the values and it recalculates automatically, unless I disabled automatic recalc for each sheet. Then I would have to .......rats Martin! I'm making things hard for me. I'll have to rest on this.
0

Featured Post

Suggested Solutions

Excel 2007 problem 2 22
VBA Excel Gantt 1 26
MS Excel Cell questions 5 39
VBA filters 2 22
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associateâ€¦
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.