# Excel Nested IF OR Statement

Hi! I'm trying to create a nested IF/OR statement and it works for the first 2 conditions, but for the 3rd, if gives me "FALSE" instead of the value. Can anyone spot my error? I'm going crazy trying to find it....
=IF(IF(OR(AG1=1,AG1=4,AG1=7,AG1=10),IF(ISBLANK(Forecast!E2),"",IF(Forecast!E2>-100000,Forecast!E2,"")),
IF(OR(AG1=2,AG1=5,AG1=8,AG1=11),IF(ISBLANK(Forecast!F2),"",IF(Forecast!F2>-100000,Forecast!F2,"")))),
IF(OR(AG1=3,AG1=6,AG1=9,AG1=12),IF(ISBLANK(Forecast!G2),"",IF(Forecast!G2>-100000,Forecast!G2,""))))
Asked:
###### Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
McQMom,

I think will be easier if you describe what the logic should be using sentences.

A sample file (with any sensitive data removed/obfuscated) would be helpful too :)

Patrick
0
Author Commented:
Let me try to do that. Should be just a couple of minutes...
0
Commented:
Try

=IF(ISBLANK(Forecast!E2),"",IF(MOD(AG1,3)=1,IF(Forecast!E2>-100000,Forecast!E2,""),IF(MOD(AG1,3)=2,IF(Forecast!F2>-100000,Forecast!F2,""),IF(MOD(AG1,3)=0,IF(Forecast!G2>-100000,Forecast!G2,"")))))

Thomas
0
Author Commented:
Here you go. This will be where our quarterly forecasts will be located. It will be updated and changed each month/qtr. Experts-Exchange-forecast-templa.xlsm
0
Commented:
Or

=IF(ISBLANK(Forecast!E2),"",IF(OFFSET(Forecast!\$E\$2,0,MOD(MOD(AG1,3)-1,3),1,1)>-100000,OFFSET(Forecast!\$E\$2,0,MOD(MOD(AG1,3)-1,3),1,1),""))

even though I think the mod(mod( structure can be improved

Thomas
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Thanks - let me give it a try
0
Commented:
Hello Thomas (not for points)
I think you can replace this part

=MOD(MOD(AG1,3)-1,3)

with

=MOD(AG1-1,3)
0
Mechanical EngineerCommented:
Brute force formula:
=IF(AND(OR(AG1={1,4,7,10}),Forecast!E2<>"",Forecast!E2>-100000),Forecast!E2,
IF(AND(OR(AG1={2,5,8,11}),Forecast!F2<>"",Forecast!F2>-100000),Forecast!F2,
IF(AND(OR(AG1={3,6,9,12}),Forecast!G2<>"",Forecast!G2>-100000),Forecast!G2,"")))
0
Author Commented:
Perfect! And much cleaner! Thank you.....
0
Commented:
With barry and Brad's input, I'd finalize with

=IF(AND(OFFSET(Forecast!\$E\$2,0,MOD(AG1-1,3))<>"",OFFSET(Forecast!\$E\$2,0,MOD(AG1-1,3))>-100000),OFFSET(Forecast!\$E\$2,0,MOD(AG1-1,3)),"")

Thomas
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.