Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default how do i if statement for 3 variables

hi
i have a problem with using the if statement. i am updating a calculator
where a new value for the 2008 year.

here is the old if statement:
=IF(C1<=2006,16.8,22)*N1 giving a result for any date of 2006 or before
of 16.8 and 22 for 2007. N1 HAS A VALUE IN THE CELL
I taught that this was the updated calculator as 2008 has value of 24 to
return

=IF(C1<=2006,16.8,IF(C1=2007,22,IF(C1=2008,24)))* N1
I PUT THIS IN BUT THE RESULT RETURNED FOR 2008 STAYED AT 22

ANY IDEAS ??

p.s. C1 HAS CODE IN THE VISUAL BASIC EDITOR DOES THIS HAVE TO BE CHANGED TO
INCORPOATE THE 2008 VALUE?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default how do i if statement for 3 variables

What do you get with the formula =C1?
Another thing to check if you are not getting the expected result is Tools/
Options/ Calculation, & make sure is says Automatic, not Manual.
--
David Biddulph

"wheefus" wrote in message
...
hi
i have a problem with using the if statement. i am updating a calculator
where a new value for the 2008 year.

here is the old if statement:
=IF(C1<=2006,16.8,22)*N1 giving a result for any date of 2006 or
before
of 16.8 and 22 for 2007. N1 HAS A VALUE IN THE
CELL
I taught that this was the updated calculator as 2008 has value of 24 to
return

=IF(C1<=2006,16.8,IF(C1=2007,22,IF(C1=2008,24)))* N1
I PUT THIS IN BUT THE RESULT RETURNED FOR 2008 STAYED AT 22

ANY IDEAS ??

p.s. C1 HAS CODE IN THE VISUAL BASIC EDITOR DOES THIS HAVE TO BE CHANGED
TO
INCORPOATE THE 2008 VALUE?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default how do i if statement for 3 variables

On Dec 12, 2:27 pm, wheefus wrote:
here is the old if statement:
=IF(C1<=2006,16.8,22)*N1

giving a result for any date of 2006 or before of 16.8 and 22 for 2007.
[....] I taught that this was the updated calculator as 2008 has value
of 24 to return
=IF(C1<=2006,16.8,IF(C1=2007,22,IF(C1=2008,24)))* N1


Following the paradigm of the first example, you should be able to
simplifiy the latter example as follows:

=IF(C1<=2006, 16.8, IF(C1<=2007, 22, 24))*N1

But that probably does not solve your problem.

I PUT THIS IN BUT THE RESULT RETURNED FOR 2008 STAYED AT 22
ANY IDEAS ??


Of course, it depends on what is in C1. If you have Excel 2003 or
later, click on ToolsFormula AuditingEvaluate Formula to step
through the formula evaluation. That might help you see the problem.
Off-hand, I do not see any problem with the extended logic of the IF()
expression, even as you wrote it.

(Unless C1 has a value greater than 2007 but less than 2008, which is
expected to be interpreted as the "2008" condition -- that is, your
IF() expression is intended to result in 24.)

p.s. C1 HAS CODE IN THE VISUAL BASIC EDITOR DOES THIS HAVE
TO BE CHANGED TO INCORPOATE THE 2008 VALUE?


That is very real possibility. There is no way for us to know unless
you post the VBA code. Then again, it might be complicated and not
worth our time to dissect. Using the Evaluate Formula tool should
help you see if that is where the problem is.

PS: If you do not have Evaluate Formula (Excel 2000 or earlier, I
believe), you could highlight portions of the formula in the "fx"
function field under the toolbar and use F9 to see how the sub-
expression is evaluated. Personally, I don't like that approach, at
least not as it is implemented in Excel 2003. But apparently it has
been recommended by experts in these NGs.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default how do i if statement for 3 variables

The way I do 'evaluate formula' in excel 2000, is to click the = button next
to the formula. It opens a window which shows the current function, what all
the variables for it are and what everything currently evaluates to. Then
click on different functions to go up/down the chain.

"joeu2004" wrote:

On Dec 12, 2:27 pm, wheefus wrote:
here is the old if statement:
=IF(C1<=2006,16.8,22)*N1

giving a result for any date of 2006 or before of 16.8 and 22 for 2007.
[....] I taught that this was the updated calculator as 2008 has value
of 24 to return
=IF(C1<=2006,16.8,IF(C1=2007,22,IF(C1=2008,24)))* N1


Following the paradigm of the first example, you should be able to
simplifiy the latter example as follows:

=IF(C1<=2006, 16.8, IF(C1<=2007, 22, 24))*N1

But that probably does not solve your problem.

I PUT THIS IN BUT THE RESULT RETURNED FOR 2008 STAYED AT 22
ANY IDEAS ??


Of course, it depends on what is in C1. If you have Excel 2003 or
later, click on ToolsFormula AuditingEvaluate Formula to step
through the formula evaluation. That might help you see the problem.
Off-hand, I do not see any problem with the extended logic of the IF()
expression, even as you wrote it.

(Unless C1 has a value greater than 2007 but less than 2008, which is
expected to be interpreted as the "2008" condition -- that is, your
IF() expression is intended to result in 24.)

p.s. C1 HAS CODE IN THE VISUAL BASIC EDITOR DOES THIS HAVE
TO BE CHANGED TO INCORPOATE THE 2008 VALUE?


That is very real possibility. There is no way for us to know unless
you post the VBA code. Then again, it might be complicated and not
worth our time to dissect. Using the Evaluate Formula tool should
help you see if that is where the problem is.

PS: If you do not have Evaluate Formula (Excel 2000 or earlier, I
believe), you could highlight portions of the formula in the "fx"
function field under the toolbar and use F9 to see how the sub-
expression is evaluated. Personally, I don't like that approach, at
least not as it is implemented in Excel 2003. But apparently it has
been recommended by experts in these NGs.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default how do i if statement for 3 variables

=N1*CHOOSE(2+SIGN(2007-C1),24,22,16.8)

Regards,
Bernd


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default how do i if statement for 3 variables


hi the excel program in relation to the question you answered for me earlier
i can email you the program as it cant be posted here
cheers
as answer didnt work

"David Biddulph" wrote:

What do you get with the formula =C1?
Another thing to check if you are not getting the expected result is Tools/
Options/ Calculation, & make sure is says Automatic, not Manual.
--
David Biddulph

"wheefus" wrote in message
...
hi
i have a problem with using the if statement. i am updating a calculator
where a new value for the 2008 year.

here is the old if statement:
=IF(C1<=2006,16.8,22)*N1 giving a result for any date of 2006 or
before
of 16.8 and 22 for 2007. N1 HAS A VALUE IN THE
CELL
I taught that this was the updated calculator as 2008 has value of 24 to
return

=IF(C1<=2006,16.8,IF(C1=2007,22,IF(C1=2008,24)))* N1
I PUT THIS IN BUT THE RESULT RETURNED FOR 2008 STAYED AT 22

ANY IDEAS ??

p.s. C1 HAS CODE IN THE VISUAL BASIC EDITOR DOES THIS HAVE TO BE CHANGED
TO
INCORPOATE THE 2008 VALUE?




  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default how do i if statement for 3 variables

hi the excel program in relation to the question you answered for me earlier
i can email you the program as it cant be posted here
cheers
as answer didnt work

"Bernd P" wrote:

=N1*CHOOSE(2+SIGN(2007-C1),24,22,16.8)

Regards,
Bernd

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default how do i if statement for 3 variables

hi the excel program in relation to the question you answered for me earlier
i can email you the program as it cant be posted here
cheers
as answer didnt work

"KLEBESTIFT" wrote:

The way I do 'evaluate formula' in excel 2000, is to click the = button next
to the formula. It opens a window which shows the current function, what all
the variables for it are and what everything currently evaluates to. Then
click on different functions to go up/down the chain.

"joeu2004" wrote:

On Dec 12, 2:27 pm, wheefus wrote:
here is the old if statement:
=IF(C1<=2006,16.8,22)*N1

giving a result for any date of 2006 or before of 16.8 and 22 for 2007.
[....] I taught that this was the updated calculator as 2008 has value
of 24 to return
=IF(C1<=2006,16.8,IF(C1=2007,22,IF(C1=2008,24)))* N1


Following the paradigm of the first example, you should be able to
simplifiy the latter example as follows:

=IF(C1<=2006, 16.8, IF(C1<=2007, 22, 24))*N1

But that probably does not solve your problem.

I PUT THIS IN BUT THE RESULT RETURNED FOR 2008 STAYED AT 22
ANY IDEAS ??


Of course, it depends on what is in C1. If you have Excel 2003 or
later, click on ToolsFormula AuditingEvaluate Formula to step
through the formula evaluation. That might help you see the problem.
Off-hand, I do not see any problem with the extended logic of the IF()
expression, even as you wrote it.

(Unless C1 has a value greater than 2007 but less than 2008, which is
expected to be interpreted as the "2008" condition -- that is, your
IF() expression is intended to result in 24.)

p.s. C1 HAS CODE IN THE VISUAL BASIC EDITOR DOES THIS HAVE
TO BE CHANGED TO INCORPOATE THE 2008 VALUE?


That is very real possibility. There is no way for us to know unless
you post the VBA code. Then again, it might be complicated and not
worth our time to dissect. Using the Evaluate Formula tool should
help you see if that is where the problem is.

PS: If you do not have Evaluate Formula (Excel 2000 or earlier, I
believe), you could highlight portions of the formula in the "fx"
function field under the toolbar and use F9 to see how the sub-
expression is evaluated. Personally, I don't like that approach, at
least not as it is implemented in Excel 2003. But apparently it has
been recommended by experts in these NGs.


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
Conditional Statement with many variables Krista Excel Discussion (Misc queries) 3 May 12th 06 10:58 PM
Too many variables for an if than statement? repke New Users to Excel 3 May 2nd 06 05:01 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 March 1st 06 12:00 AM
Using variables as first and last cells in range statement Tom from Ga Excel Worksheet Functions 2 February 6th 06 10:08 PM
Two variables Blackcat Excel Discussion (Misc queries) 7 January 7th 05 01:13 PM


All times are GMT +1. The time now is 10:49 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"