Multiple Embedded IF/AND Statements

ngann

New Member
Joined
Jan 18, 2018
Messages
21
This below formula is only returning the first IF Statements Value if True value and everything else is just 0. Does anyone know why this is happening?

=IF((AND(B3<G3>0,B3<L3>0,B3<Q3>0,B3<V3>0)),B3,IF((AND(G3<B3>0,G3<L3>0,G3<Q3>0,G3<V3>0)),G3,IF((AND(L3<B3>0,L3<G3>0,L3<Q3>0,L3<V3>0)),L3,IF((AND(Q3<B3>0,Q3<G3>0,Q3<L3>0,Q3<V3>0)),Q3,IF((AND(V3<B3>0,V3<G3>0,V3<L3>0,V3<Q3>0)),V3,"")))))
 
Last edited by a moderator:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi ngann,

This is because statements like B3<G3>0 are partially invalid and will always evaluate only the first part (B3<G3). Try to paste =B3<G3>0 into a separate cell and see how it behaves depending on B3 and G3 values. You will notice that "G3>0" part is always being ignored.

In order to solve it you'd need to adjust all such statements in your formula to evaluate both parts, i.e. =AND(B3<G3,G3>0)

Hope it helps.
 
Upvote 0
+ edit - sorry, all my formulas were "cut" when I posted my reply (HTML issue) and only just now I realised how silly it looks...

Just to rephrase (with spaces):

This is because statements like "<g3 style="color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">B3 < G3 > 0" are partially invalid and will always evaluate only the first part. Paste "=<g3). try="" to="" paste="B3<G3">B3 < G3 > 0" into a separate cell and see how it behaves depending on B3 and G3 values. You will notice that "G3>0" part is always being ignored.
In order to solve it you'd need to adjust all such statements in your formula to evaluate both parts, i.e. =AND(B3 < G3, G3 >
<g3,g3>0)

+ But it looks like Special-K99's solution is much better.</g3,g3></g3).></g3>
 
Upvote 0
I cant use the MIN formula because I need it to return the lowest value that is >0. If I use the MIN formula it will only return 0.
 
Upvote 0
=MIN(IF(b3>0,b3,9.9E+307),IF(l3>0,l3,9.9E+307),IF(q3>0,q3,9.9E+307),IF(v3>0,v3,9.9E+307))
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top