View Single Post
  #1   Report Post  
CJ
 
Posts: n/a
Default # Range inside "Nested If" Statement

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