Reply
 
Thread Tools Display Modes
  #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

  #2   Report Post  
Greg Maxey
 
Posts: n/a
Default

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

CJ wrote:
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



  #3   Report Post  
CJ
 
Posts: n/a
Default

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

CJ wrote:
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



.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert carriage return in mergefield statement dixie Mailmerge 2 December 22nd 04 04:42 AM
Printing single pages or a range of pages Craig Mailmerge 1 December 13th 04 02:51 AM
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements Mark V Mailmerge 8 November 30th 04 02:31 PM


All times are GMT +1. The time now is 07:39 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"