Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Abi
 
Posts: n/a
Default =IF Statement formula or conditional formatting

I'm trying to solve a problem with a formula I'd like to write. I think I'm
doing it correctly, but it keeps giving me a circular reference error.

What I want:
If data entry in the cell is 1, make the cell read One-Man, otherwise make
the cell read Two-Man. (It will only ever be 1 or 2.)

What I was trying to use:
=IF(B205=1,"One-Man","Two-Man")
or some iteration of that.

Maybe I should be using a different formula function. I'm not sure. Help!
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Abi,

If you are putting that formula in B205, QED, circular reference.

A formula cannot refer to its own containing cell, only other cells. So you
formula needs to go in C205 or somewhere.

--
HTH

-------

Bob Phillips
"Abi" wrote in message
...
I'm trying to solve a problem with a formula I'd like to write. I think

I'm
doing it correctly, but it keeps giving me a circular reference error.

What I want:
If data entry in the cell is 1, make the cell read One-Man, otherwise make
the cell read Two-Man. (It will only ever be 1 or 2.)

What I was trying to use:
=IF(B205=1,"One-Man","Two-Man")
or some iteration of that.

Maybe I should be using a different formula function. I'm not sure.

Help!


  #3   Report Post  
JulieD
 
Posts: n/a
Default

Hi Abi

because you're trying to change a value in the same cell as your formula you
will get a circular reference error however, one way to approach it is via
VBA

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Range("B205") = 1 Then
Range("B205") = "One-Man"
Elseif Range("B205") = 2 then
Range("B205") = "Two-Man"
Else
Range("B205") = ""
End If
Application.EnableEvents = True
End Sub

- to use this code, right mouse click on the sheet tab where you want the
code and choose view code
copy & paste the code there

Cheers
JulieD

"Abi" wrote in message
...
I'm trying to solve a problem with a formula I'd like to write. I think
I'm
doing it correctly, but it keeps giving me a circular reference error.

What I want:
If data entry in the cell is 1, make the cell read One-Man, otherwise make
the cell read Two-Man. (It will only ever be 1 or 2.)

What I was trying to use:
=IF(B205=1,"One-Man","Two-Man")
or some iteration of that.

Maybe I should be using a different formula function. I'm not sure.
Help!



  #4   Report Post  
Abi
 
Posts: n/a
Default

It works great! Thanks! (And thanks for the easy-to-use instructions - some
days I'm not too quick!) :)

Do you have any recommendations for a website or book (preferrably the
website) that has a "VBA for slow people" approach to learning some of the VB
basics?

Thanks!

"JulieD" wrote:

Hi Abi

because you're trying to change a value in the same cell as your formula you
will get a circular reference error however, one way to approach it is via
VBA

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Range("B205") = 1 Then
Range("B205") = "One-Man"
Elseif Range("B205") = 2 then
Range("B205") = "Two-Man"
Else
Range("B205") = ""
End If
Application.EnableEvents = True
End Sub

- to use this code, right mouse click on the sheet tab where you want the
code and choose view code
copy & paste the code there

Cheers
JulieD

"Abi" wrote in message
...
I'm trying to solve a problem with a formula I'd like to write. I think
I'm
doing it correctly, but it keeps giving me a circular reference error.

What I want:
If data entry in the cell is 1, make the cell read One-Man, otherwise make
the cell read Two-Man. (It will only ever be 1 or 2.)

What I was trying to use:
=IF(B205=1,"One-Man","Two-Man")
or some iteration of that.

Maybe I should be using a different formula function. I'm not sure.
Help!




  #5   Report Post  
Abi
 
Posts: n/a
Default

You know, last week when I entered the script into my worksheet, it worked.
Then, I had some odd stuff happen to my template and lost some info so I had
to re-add the script - and now I can't get it to work. I'm literally just
cut and pasting it and just changing the cell from 205 to 208 (the actual
reference cell).

I'm stumped!

"JulieD" wrote:

Hi Abi

because you're trying to change a value in the same cell as your formula you
will get a circular reference error however, one way to approach it is via
VBA

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Range("B205") = 1 Then
Range("B205") = "One-Man"
Elseif Range("B205") = 2 then
Range("B205") = "Two-Man"
Else
Range("B205") = ""
End If
Application.EnableEvents = True
End Sub

- to use this code, right mouse click on the sheet tab where you want the
code and choose view code
copy & paste the code there

Cheers
JulieD

"Abi" wrote in message
...
I'm trying to solve a problem with a formula I'd like to write. I think
I'm
doing it correctly, but it keeps giving me a circular reference error.

What I want:
If data entry in the cell is 1, make the cell read One-Man, otherwise make
the cell read Two-Man. (It will only ever be 1 or 2.)

What I was trying to use:
=IF(B205=1,"One-Man","Two-Man")
or some iteration of that.

Maybe I should be using a different formula function. I'm not sure.
Help!






  #6   Report Post  
Abi
 
Posts: n/a
Default

Okay - I got it to work, but I'm confused. When it didn't work, I was
pasting at the bottom of the screen (past the other scripts I have.) This
time I pasted it at the very top and it worked. Is that supposed to matter?
(I am VERY green about VB.)

Thanks!

"JulieD" wrote:

Hi Abi

because you're trying to change a value in the same cell as your formula you
will get a circular reference error however, one way to approach it is via
VBA

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Range("B205") = 1 Then
Range("B205") = "One-Man"
Elseif Range("B205") = 2 then
Range("B205") = "Two-Man"
Else
Range("B205") = ""
End If
Application.EnableEvents = True
End Sub

- to use this code, right mouse click on the sheet tab where you want the
code and choose view code
copy & paste the code there

Cheers
JulieD

"Abi" wrote in message
...
I'm trying to solve a problem with a formula I'd like to write. I think
I'm
doing it correctly, but it keeps giving me a circular reference error.

What I want:
If data entry in the cell is 1, make the cell read One-Man, otherwise make
the cell read Two-Man. (It will only ever be 1 or 2.)

What I was trying to use:
=IF(B205=1,"One-Man","Two-Man")
or some iteration of that.

Maybe I should be using a different formula function. I'm not sure.
Help!




  #7   Report Post  
JulieD
 
Posts: n/a
Default

Hi Abi

glad you solved it - sorry i didn't get back to you before now - we've got
bushfires near us and the power hasn't been that reliable lately.

when you did the view code option the cursor generally goes to the place
where you should paste the code - it needed to be against the worksheet
itself and not in a module.

Hope this helps
Cheers
JulieD

"Abi" wrote in message
...
Okay - I got it to work, but I'm confused. When it didn't work, I was
pasting at the bottom of the screen (past the other scripts I have.) This
time I pasted it at the very top and it worked. Is that supposed to
matter?
(I am VERY green about VB.)

Thanks!

"JulieD" wrote:

Hi Abi

because you're trying to change a value in the same cell as your formula
you
will get a circular reference error however, one way to approach it is
via
VBA

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Range("B205") = 1 Then
Range("B205") = "One-Man"
Elseif Range("B205") = 2 then
Range("B205") = "Two-Man"
Else
Range("B205") = ""
End If
Application.EnableEvents = True
End Sub

- to use this code, right mouse click on the sheet tab where you want the
code and choose view code
copy & paste the code there

Cheers
JulieD

"Abi" wrote in message
...
I'm trying to solve a problem with a formula I'd like to write. I
think
I'm
doing it correctly, but it keeps giving me a circular reference error.

What I want:
If data entry in the cell is 1, make the cell read One-Man, otherwise
make
the cell read Two-Man. (It will only ever be 1 or 2.)

What I was trying to use:
=IF(B205=1,"One-Man","Two-Man")
or some iteration of that.

Maybe I should be using a different formula function. I'm not sure.
Help!






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula Dependant Conditional Formatting LDanix Excel Discussion (Misc queries) 1 January 13th 05 06:50 PM
Conditional formatting based on if statement. kevin Excel Worksheet Functions 2 January 12th 05 03:07 AM
conditional formatting conflict? Abi Excel Worksheet Functions 2 January 11th 05 03:41 PM
Copy conditional formatting across multiple rows? Gil Excel Discussion (Misc queries) 1 January 11th 05 11:27 AM
Conditional formatting not available in Excel BAB Excel Discussion (Misc queries) 2 January 1st 05 03:33 PM


All times are GMT +1. The time now is 10:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"