A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Help with IIf Statement



 
 
Thread Tools Display Modes
  #1  
Old May 6th, 2008, 08:02 PM posted to microsoft.public.access.forms
ADD NEW DATA IN FORM?[_2_]
external usenet poster
 
Posts: 7
Default Help with IIf Statement

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
  #2  
Old May 6th, 2008, 08:44 PM posted to microsoft.public.access.forms
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default Help with IIf Statement

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?" 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


  #3  
Old May 6th, 2008, 08:55 PM posted to microsoft.public.access.forms
ADD NEW DATA IN FORM?[_2_]
external usenet poster
 
Posts: 7
Default Help with IIf Statement

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

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?" 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



  #4  
Old May 6th, 2008, 11:16 PM posted to microsoft.public.access.forms
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Help with IIf Statement

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?" wrote:

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

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?" 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



  #5  
Old May 7th, 2008, 01:25 PM posted to microsoft.public.access.forms
ADD NEW DATA IN FORM?[_2_]
external usenet poster
 
Posts: 7
Default Help with IIf Statement

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

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?" wrote:

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

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?" 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


  #6  
Old May 7th, 2008, 03:03 PM posted to microsoft.public.access.forms
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default Help with IIf Statement

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?" wrote
in message ...
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" wrote:

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?" wrote:

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

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?"
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



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:15 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.