Help with IIf Statement

  • Thread starter ADD NEW DATA IN FORM?
  • Start date
A

ADD NEW DATA IN FORM?

Keep in mind that I have most of the fields. the only thing I don't have
which should be include in the statement are the dates. I have the RACC
field, serving size, sodium, cholesterol etc... I just don't know how to do
this IIf statement

SODIUM: Before January 1, 1998: <=480 mg per RACC and per Serving, EXCEPT if
RACC <=30g-- <=480 mg per 50 g of food; after January 1, 1998: this level
reduces to <=360 mg

CHOLESTEROL: <=60 mg per RACC, per serving, and if RACC <=30g per 50g of food
 
B

BruceM

You would probably nest the IIf statements, but not being a dietician or
otherwise conversant with the lingo it is difficult for me to know just what
you are trying to do. You have <= 480 mg per RACC, but RACC is apparently
expressed in grams, so what does "per RACC" mean? Per gram of RACC? To
complicate matters, you are testing per RACC and per serving. Is serving a
unit, or is it some number of grams, or what? If the former, where does the
50 grams of food fit into the picture?
Maybe somebody will understand what you are trying to do, but you may need
to explain this in plain language.
 
A

ADD NEW DATA IN FORM?

HELLO
this is what I came up with but isn't working properly...I need a beginning
and ending dates....where does the "EXCEPT AND DATE FIT???

Sodium Healthy Claim1:IIf([Food Type]="Individual Foods",IIf([Sodium
(mg)]<=(480/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(480/([Serving Size]*1000))) And ([Sodium (mg)]<=(480/(50*1000))),"Low
Sodium","")),"")

Sodium Healthy Claim2:IIf([Food Type]="Meals/Main Dishes",IIf([Sodium
(mg)]<=(600/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(600/([Serving Size]*1000))) And ([Sodium (mg)]<=(600/(50*1000))),"Low
Sodium","")),"")
 
K

KARL DEWEY

Post your table structure - fields names and datatype.
[Food Type]
[RACC]
[Sodium (mg)]
[Serving Size]
cholesterol ??
Some date ??

--
KARL DEWEY
Build a little - Test a little


ADD NEW DATA IN FORM? said:
HELLO
this is what I came up with but isn't working properly...I need a beginning
and ending dates....where does the "EXCEPT AND DATE FIT???

Sodium Healthy Claim1:IIf([Food Type]="Individual Foods",IIf([Sodium
(mg)]<=(480/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(480/([Serving Size]*1000))) And ([Sodium (mg)]<=(480/(50*1000))),"Low
Sodium","")),"")

Sodium Healthy Claim2:IIf([Food Type]="Meals/Main Dishes",IIf([Sodium
(mg)]<=(600/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(600/([Serving Size]*1000))) And ([Sodium (mg)]<=(600/(50*1000))),"Low
Sodium","")),"")


BruceM said:
You would probably nest the IIf statements, but not being a dietician or
otherwise conversant with the lingo it is difficult for me to know just what
you are trying to do. You have <= 480 mg per RACC, but RACC is apparently
expressed in grams, so what does "per RACC" mean? Per gram of RACC? To
complicate matters, you are testing per RACC and per serving. Is serving a
unit, or is it some number of grams, or what? If the former, where does the
50 grams of food fit into the picture?
Maybe somebody will understand what you are trying to do, but you may need
to explain this in plain language.
 
A

ADD NEW DATA IN FORM?

I have [Food Type], [RACC], [Sodium (mg)], [Serving Size] [cholesterol]
I don't have any fields for the dates and I don't understand if those dates
should be fields? I also don't understand what "EXCEPT" is suppose to give or
do in the IIF statement. Anyway here what I have and it didn't work?

Sodium Healthy Claim1:IIf([Food Type]="Individual Foods",IIf([Sodium
(mg)]<=(480/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(480/([Serving Size]*1000))) And ([Sodium
(mg)]<=(480/(50*1000))),"Low
Sodium","")),"")





KARL DEWEY said:
Post your table structure - fields names and datatype.
[Food Type]
[RACC]
[Sodium (mg)]
[Serving Size]
cholesterol ??
Some date ??

--
KARL DEWEY
Build a little - Test a little


ADD NEW DATA IN FORM? said:
HELLO
this is what I came up with but isn't working properly...I need a beginning
and ending dates....where does the "EXCEPT AND DATE FIT???

Sodium Healthy Claim1:IIf([Food Type]="Individual Foods",IIf([Sodium
(mg)]<=(480/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(480/([Serving Size]*1000))) And ([Sodium (mg)]<=(480/(50*1000))),"Low
Sodium","")),"")

Sodium Healthy Claim2:IIf([Food Type]="Meals/Main Dishes",IIf([Sodium
(mg)]<=(600/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(600/([Serving Size]*1000))) And ([Sodium (mg)]<=(600/(50*1000))),"Low
Sodium","")),"")


BruceM said:
You would probably nest the IIf statements, but not being a dietician or
otherwise conversant with the lingo it is difficult for me to know just what
you are trying to do. You have <= 480 mg per RACC, but RACC is apparently
expressed in grams, so what does "per RACC" mean? Per gram of RACC? To
complicate matters, you are testing per RACC and per serving. Is serving a
unit, or is it some number of grams, or what? If the former, where does the
50 grams of food fit into the picture?
Maybe somebody will understand what you are trying to do, but you may need
to explain this in plain language.

in message Keep in mind that I have most of the fields. the only thing I don't have
which should be include in the statement are the dates. I have the RACC
field, serving size, sodium, cholesterol etc... I just don't know how to
do
this IIf statement

SODIUM: Before January 1, 1998: <=480 mg per RACC and per Serving, EXCEPT
if
RACC <=30g-- <=480 mg per 50 g of food; after January 1, 1998: this level
reduces to <=360 mg

CHOLESTEROL: <=60 mg per RACC, per serving, and if RACC <=30g per 50g of
food
 
B

BruceM

In your original post you stated the conditions "Before Jan. 1, 1998" and
"On or after Jan.1, 1998". If those dates aren't fields, where do they come
from?
Do you have just one table? Please post some sample data (a simplified
version would be fine). Don't assume any of us know what RACC is. You are
performing math on it, so presumably it is a number. Is that correct?
In my first response I asked that you describe in plain language what you
need to do. That would still be helpful. Another thing that would help is
knowing what you expect from the IIf statements, and in what way they do not
work.
What happens if FoodType is not "Individual Foods", or if sodium is above
the level determined by the calculation? Is anything other than "Low
Sodium" an empty string? Is there no "High Sodium"?
An IIf statement may not be the best approach, but again there is no way to
know without understanding something of what you are trying to do.

ADD NEW DATA IN FORM? said:
I have [Food Type], [RACC], [Sodium (mg)], [Serving Size] [cholesterol]
I don't have any fields for the dates and I don't understand if those
dates
should be fields? I also don't understand what "EXCEPT" is suppose to give
or
do in the IIF statement. Anyway here what I have and it didn't work?

Sodium Healthy Claim1:IIf([Food Type]="Individual Foods",IIf([Sodium
(mg)]<=(480/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(480/([Serving Size]*1000))) And ([Sodium
(mg)]<=(480/(50*1000))),"Low
Sodium","")),"")





KARL DEWEY said:
Post your table structure - fields names and datatype.
[Food Type]
[RACC]
[Sodium (mg)]
[Serving Size]
cholesterol ??
Some date ??

--
KARL DEWEY
Build a little - Test a little


ADD NEW DATA IN FORM? said:
HELLO
this is what I came up with but isn't working properly...I need a
beginning
and ending dates....where does the "EXCEPT AND DATE FIT???

Sodium Healthy Claim1:IIf([Food Type]="Individual Foods",IIf([Sodium
(mg)]<=(480/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(480/([Serving Size]*1000))) And ([Sodium
(mg)]<=(480/(50*1000))),"Low
Sodium","")),"")

Sodium Healthy Claim2:IIf([Food Type]="Meals/Main Dishes",IIf([Sodium
(mg)]<=(600/([RACC]*1000))," Low Sodium",""),IIf(([Sodium
(mg)]<=(600/([Serving Size]*1000))) And ([Sodium
(mg)]<=(600/(50*1000))),"Low
Sodium","")),"")


:

You would probably nest the IIf statements, but not being a dietician
or
otherwise conversant with the lingo it is difficult for me to know
just what
you are trying to do. You have <= 480 mg per RACC, but RACC is
apparently
expressed in grams, so what does "per RACC" mean? Per gram of RACC?
To
complicate matters, you are testing per RACC and per serving. Is
serving a
unit, or is it some number of grams, or what? If the former, where
does the
50 grams of food fit into the picture?
Maybe somebody will understand what you are trying to do, but you may
need
to explain this in plain language.

"ADD NEW DATA IN FORM?" <[email protected]>
wrote
in message Keep in mind that I have most of the fields. the only thing I don't
have
which should be include in the statement are the dates. I have the
RACC
field, serving size, sodium, cholesterol etc... I just don't know
how to
do
this IIf statement

SODIUM: Before January 1, 1998: <=480 mg per RACC and per Serving,
EXCEPT
if
RACC <=30g-- <=480 mg per 50 g of food; after January 1, 1998: this
level
reduces to <=360 mg

CHOLESTEROL: <=60 mg per RACC, per serving, and if RACC <=30g per
50g of
food
 

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