I tried your example and it worked as it should. If you have a large number of nested If statements consider using the Select Case construct in VBA. I created a function cmp() included in the attached workbook that uses Case Select to to what you want.
On Fri, Nov 14, 2008 at 10:48 AM, jmholt <[EMAIL PROTECTED]> wrote: > > I'm trying to figure out nested IF statements. The statement below > works fine except for the last argument: > > IF(C7<=542,11,IF(C7<=589,12,L16)). > > IF C7=540 then it returns 11. > > If C7 = 560 then it returns the value from L16 and not 12. > > Any ideas why it is not returning the the TRUE value? Is there a > better method then using nested IF's? > > John > > > > --~--~---------~--~----~------------~-------~--~----~ Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To post to this group, send email to excel-macros@googlegroups.com For more options, visit this group at http://groups.google.com/group/excel-macros?hl=en Visit & Join Our Orkut Community at http://www.orkut.com/Community.aspx?cmm=22913620 Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com To see the Daily Excel Tips, Go to: http://exceldailytip.blogspot.com -~----------~----~----~----~------~----~------~--~---
cmp.xls
Description: MS-Excel spreadsheet