# Range inside "Nested If" Statement

C

CJ

I'm merging with an Excel spreadsheet. I want to indicate
a blood alcohol concentration (BAC) depending on the
gender and weight of the individual. Instead of typing in
100 individual weights, I want to group in ranges of 20
lbs: 100 lbs, 120 lbs, 140 lbs, etc. If the individual's
weight is 115 lbs, I want the BAC to report as the BAC for
100 lbs by using a range inside the nested IF statement.
So 100 - 119 lbs will report as the BAC for 100 lbs, 120 -
139 lbs will report BAC for 120 lbs, etc. End result will
appear as:

1 standard drink in 1 hour = .?? BAC
2 standard drinks in 1 hour = .?? BAC
3 standard drinks in 1 hour = .?? BAC

Here's the code I'm currently working with that doesn't
include the range I'm wanting to use:

1 standard drink in 1 hour = {IF{=AND({COMPARE{MERGEFIELD
gender}=F},{COMPARE{MERGEFIELD weight}=100}){}}=1 ".05""{IF
{=AND({COMPARE{MERGEFIELD gender}=M},{COMPARE{MERGEFIELD
weight}=100}){}}=1 ".04""{IF{=AND({COMPARE{MERGEFIELD
gender}=F},{COMPARE{MERGEFIELD weight}=120}){}}=1 ".04""{IF
{=AND({COMPARE{MERGEFIELD gender}=M},{COMPARE{MERGEFIELD
weight}=120}){}}=1 ".04""{IF{=AND({COMPARE{MERGEFIELD
gender}=F},{COMPARE{MERGEFIELD weight}=140}){}}=1 ".04""{IF
{=AND({COMPARE{MERGEFIELD gender}=M},{COMPARE{MERGEFIELD
weight}=140}){}}=1 ".03 etc. etc.

What I need is the syntax that will create the range 100 -
119 and 120 - 139 and ....

Any help will be greatly appreciated! Thanks in advance.

CJ
 
G

Greg Maxey

CJ,

This might get you on track.

{ IF { =AND({ Compare{ Gender }=F}, AND({= Wt }>100,{
=Wt }<=119))}="1"".05""Next Condition Statement" }
 
C

CJ

Thanks much!!
-----Original Message-----
CJ,

This might get you on track.

{ IF { =AND({ Compare{ Gender }=F}, AND({= Wt }>100,{
=Wt }<=119))}="1"".05""Next Condition Statement" }


--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top