Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 349
Default Calculated field using IF statements in the Query Grid

8:23 PM 29/12/2007

I am only a new MS Access user and so I would like some help, please, in
solving this problem using the Access Query grid.

I have an Access 2003 file with two fields as follows:

Field_1 Field_2
3 ..
1 ..
2 ..
1 ..
3 ..
2 ..
2 ..
3 ..
2 ..

My objective is to make Field_2 a calculated field by running a query that
recognises the value of Field_1 and allocates a text string according to a
simple rule. The rule is as follows:
A value of 1 in Field_1 stands for "marigold";
A value of 2 in Field_1 stands for "sunflower"; and
A value of 3 in Field_1 stands for "rose".

So, using my yet-to-be-formulated query, Field_2 would look like this:

Field_1 Field_2
3 rose
1 marigold
2 sunflower
1 marigold
3 rose
2 sunflower
2 sunflower
3 rose
2 sunflower

If I was using Excel, I would solve the problem using the IF function. For
example (assuming Field_1 in Access was Col A in Excel and Field_2 was Col B
in Excel),
I would put the following formula in Col B in the first row and copy it
down the colum:
=IF (A1=1, "marigold", IF (A1=2, "sunflower", IF (A1=3, "rose",)))

Knowing Microsoft, the Excel formula above should translate fairly closely
into MS Access but I do not know how to actually phrase it in the Query grid.
The query grid thingy is a little unweildy for me at my current stage of
learning about Access.

Could someone please help me?

--
Peter
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,355
Default Calculated field using IF statements in the Query Grid

You may get a quicker reply if you post this to an Access users group.
--
HTH,
Barb Reinhardt



"Peter" wrote:

8:23 PM 29/12/2007

I am only a new MS Access user and so I would like some help, please, in
solving this problem using the Access Query grid.

I have an Access 2003 file with two fields as follows:

Field_1 Field_2
3 ..
1 ..
2 ..
1 ..
3 ..
2 ..
2 ..
3 ..
2 ..

My objective is to make Field_2 a calculated field by running a query that
recognises the value of Field_1 and allocates a text string according to a
simple rule. The rule is as follows:
A value of 1 in Field_1 stands for "marigold";
A value of 2 in Field_1 stands for "sunflower"; and
A value of 3 in Field_1 stands for "rose".

So, using my yet-to-be-formulated query, Field_2 would look like this:

Field_1 Field_2
3 rose
1 marigold
2 sunflower
1 marigold
3 rose
2 sunflower
2 sunflower
3 rose
2 sunflower

If I was using Excel, I would solve the problem using the IF function. For
example (assuming Field_1 in Access was Col A in Excel and Field_2 was Col B
in Excel),
I would put the following formula in Col B in the first row and copy it
down the colum:
=IF (A1=1, "marigold", IF (A1=2, "sunflower", IF (A1=3, "rose",)))

Knowing Microsoft, the Excel formula above should translate fairly closely
into MS Access but I do not know how to actually phrase it in the Query grid.
The query grid thingy is a little unweildy for me at my current stage of
learning about Access.

Could someone please help me?

--
Peter

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 349
Default Calculated field using IF statements in the Query Grid

oops i am so sorry. i thought i did. pls accept my apology.
--
Peter


"Barb Reinhardt" wrote:

You may get a quicker reply if you post this to an Access users group.
--
HTH,
Barb Reinhardt



"Peter" wrote:

8:23 PM 29/12/2007

I am only a new MS Access user and so I would like some help, please, in
solving this problem using the Access Query grid.

I have an Access 2003 file with two fields as follows:

Field_1 Field_2
3 ..
1 ..
2 ..
1 ..
3 ..
2 ..
2 ..
3 ..
2 ..

My objective is to make Field_2 a calculated field by running a query that
recognises the value of Field_1 and allocates a text string according to a
simple rule. The rule is as follows:
A value of 1 in Field_1 stands for "marigold";
A value of 2 in Field_1 stands for "sunflower"; and
A value of 3 in Field_1 stands for "rose".

So, using my yet-to-be-formulated query, Field_2 would look like this:

Field_1 Field_2
3 rose
1 marigold
2 sunflower
1 marigold
3 rose
2 sunflower
2 sunflower
3 rose
2 sunflower

If I was using Excel, I would solve the problem using the IF function. For
example (assuming Field_1 in Access was Col A in Excel and Field_2 was Col B
in Excel),
I would put the following formula in Col B in the first row and copy it
down the colum:
=IF (A1=1, "marigold", IF (A1=2, "sunflower", IF (A1=3, "rose",)))

Knowing Microsoft, the Excel formula above should translate fairly closely
into MS Access but I do not know how to actually phrase it in the Query grid.
The query grid thingy is a little unweildy for me at my current stage of
learning about Access.

Could someone please help me?

--
Peter

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculated Field and Calculated Item in Pivot Table Fred Smith Excel Discussion (Misc queries) 0 March 4th 07 08:15 PM
PivotTable:Using a calculated field result in another calculated f Alice Excel Worksheet Functions 0 June 8th 06 05:21 PM
pivot table formulas for calculated field or calculated item Vicky Excel Discussion (Misc queries) 3 June 6th 06 05:06 AM
Excel2000: Calculated field name in ODBC Query Arvi Laanemets Excel Discussion (Misc queries) 0 March 8th 06 12:16 PM


All times are GMT +1. The time now is 05:52 AM.

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

About Us

"It's about Microsoft Excel"