Wickerman All American 2404 Posts user info edit post |
I am trying to get this logic to work in a cell..
If A+B>C then use C
If A+B<D then use D
If the above conditions are not satisfied just put A+B
I'm not very good with nested if statements..
If((A+B>C,C), if(A+B<D, D, A+B))
I used something like that statement above.. but its not working. 4/1/2010 5:45:05 PM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
yea you should be able to do an if within an if.. there's a limit on how many times you can do it some version of excel
hold on lemme look at what you did 4/1/2010 5:48:50 PM |
wdprice3 BinaryBuffonary 45912 Posts user info edit post |
If( ( A + B ) > C, C , if ( ( A + B ) < D, D, A + B ) )
minus the spaces, this should work
[Edited on April 1, 2010 at 5:56 PM. Reason : ha, html FTL] 4/1/2010 5:50:43 PM |
A Tanzarian drip drip boom 10996 Posts user info edit post |
^ +
Watch your parenthesis.
Also, be aware that if (A+B) is simultaneously greater than C and less than D, C will be returned. D will only be returned if ((A+B) <= C) AND ((A+B) < D).
I don't know what C and D are, so this may not be an issue for you. 4/1/2010 6:00:16 PM |
eleusis All American 24527 Posts user info edit post |
you can nest up to 7 logic statements in excel.
Is there a possiblility that A+B can be >C and <D at the same time? If so, you have to place the condition you want to take precedent in the first if statement. 4/1/2010 10:14:54 PM |
Wickerman All American 2404 Posts user info edit post |
Thanks for the help guys! I got it working now, I think I did it in a very inefficient way, used like 4 ifs.. but got the job done 4/1/2010 10:49:58 PM |
CalledToArms All American 22025 Posts user info edit post |
Quote : | "you can nest up to 7 logic statements in excel." |
up to 2003, but I think 2007 allows 64 total Ifs. Although, all the new functionality in Excel 2007 is annoying since most people who end up using a spreadsheet I make (including myself if I am at work) are using Excel 2003 or earlier still.
Of course, I guess most the time someone would think they need 64 If statements...there is probably a better, more efficient way to do what they are trying to do.
[Edited on April 2, 2010 at 8:23 AM. Reason : ]4/2/2010 8:21:12 AM |
eleusis All American 24527 Posts user info edit post |
I always found it easier to use a combination of case statements in another sheet and use a combination of vlookup and indirect functions when the calculation gets that complex.
being able to nest if statements does come in handy when you need to use if statements that reference other cells with if statements. 4/3/2010 11:48:32 AM |