Boat Drinks  

Go Back   Boat Drinks > General > Computer and Consoles

Reply
 
Thread Tools Display Modes
Old 22-11-2008, 15:38   #1
Feek
ex SAS
 
Feek's Avatar
 
Join Date: Jun 2006
Location: JO01ou
Posts: 10,062
Default Nesting IF statements in Excel?

I've worked out how to use a basic IF statement in Excel but I'm having problems getting my mind around working out multiple nested IFs.

I have a cell with a value in (Cell G13). If the value of that cell is greater than 4959.4 then I need the word 'one' displayed. That's easy.

Code:
=IF(G13>4959.4,"One","")
However, if the value of G13 is greater than 6323.2, the word 'two' should be displayed, and if it's above 8062.1 then the word 'three' displayed. Finally, if above 10279.2 then the word 'four' should be shown.

I've played around with multiple nesting using AND but I can't make it work. Can anyone help please?
__________________
Feek is offline   Reply With Quote
Old 22-11-2008, 15:54   #2
Wellington
Long Island Iced Tea
 
Wellington's Avatar
 
Join Date: Sep 2007
Location: Cranham, Upminster, Essex
Posts: 293
Default

On the basis that an IF statement is true or false it goes something along the lines of

If(Statement,"true","False") then you would need to use
=IF(G13>8062.1,"Three",(IF(G13>6323.2,"Two",(IF(G1 3>4959.4,"One",""))))

You would have to do so in this order as it will only read the first statement it it's "True". If you start with the lower value then a number greater than the value used in the statement would result in a true answer.
__________________
Wellington is offline   Reply With Quote
Old 22-11-2008, 16:00   #3
Burble
Rocket Fuel
 
Burble's Avatar
 
Join Date: Jul 2006
Posts: 7,826
Default

Something like this should do the trick:
Code:
=IF(G13>10279.2,"Four",IF(G13>8062.1,"Three",IF(G13>6323.2,"Two",IF(G13>4959.4,"One","")))
Burble is offline   Reply With Quote
Old 22-11-2008, 16:04   #4
Wellington
Long Island Iced Tea
 
Wellington's Avatar
 
Join Date: Sep 2007
Location: Cranham, Upminster, Essex
Posts: 293
Default

that's the one
__________________
Wellington is offline   Reply With Quote
Old 22-11-2008, 16:08   #5
Feek
ex SAS
 
Feek's Avatar
 
Join Date: Jun 2006
Location: JO01ou
Posts: 10,062
Default

Quote:
Originally Posted by Wellington View Post
If(Statement,"true","False") then you would need to use
=IF(G13>8062.1,"Three",(IF(G13>6323.2,"Two",(IF(G1 3>4959.4,"One",""))))
That nearly worked, Excel told me it was wrong and offered a correction, thus:
Code:
=IF(G13>8062.1,"Three",(IF(G13>6323.2,"Two",(IF(G13>4959.4,"One","")))))
Quote:
Originally Posted by Burble View Post
Code:
=IF(G13>10279.2,"Four",IF(G13>8062.1,"Three",IF(G13>6323.2,"Two",IF(G13>4959.4,"One","")))
That was also close! Again, it offered a correction thus:
Code:
=IF(G13>10279.2,"Four",IF(G13>8062.1,"Three",IF(G13>6323.2,"Two",IF(G13>4959.4,"One",""))))
I think that it was just a missing bracket in each case!

Thanks guys, exactly what I needed. Job is done.
__________________

Last edited by Feek; 22-11-2008 at 16:12.
Feek is offline   Reply With Quote
Old 22-11-2008, 16:10   #6
Burble
Rocket Fuel
 
Burble's Avatar
 
Join Date: Jul 2006
Posts: 7,826
Default

My copy and paste skills let me down a bit - there should been an extra ) at the end of mine.

Glad 'tis sorted though.
Burble is offline   Reply With Quote
Old 22-11-2008, 20:45   #7
Wellington
Long Island Iced Tea
 
Wellington's Avatar
 
Join Date: Sep 2007
Location: Cranham, Upminster, Essex
Posts: 293
Default

I just made mine up in my head not surprised there was a ickle bit wrong...

anywho it works now...
__________________
Wellington is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:25.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.