Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Excel IF function help

Hello-

I need to write a statement similar to:

IF (F2 = 4 AND J2 = 4) then AA2 = "Northwest" else AA2 leave at whatever
value is currently there (no change)

IF (F2 <=2 AND J2 =4) then AA2 = "Northeast" else AA2 leave at whatever
value is currently there (no change)

How do I do this in excel?
Thank you so much
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Excel IF function help

This can not be done with a formula, unless it resides in AA2. But then it
can't leave whatever AA2 value it has, because AA2 contains this formula,
not a value.

So you need a VBA macro to do this. My question is, before writing a
suggestion: When do you want this action to happen, and how does the values
change in F2 and J2 ?

Best wishes Harald

"DTTODGG" skrev i melding
...
Hello-

I need to write a statement similar to:

IF (F2 = 4 AND J2 = 4) then AA2 = "Northwest" else AA2 leave at whatever
value is currently there (no change)

IF (F2 <=2 AND J2 =4) then AA2 = "Northeast" else AA2 leave at whatever
value is currently there (no change)

How do I do this in excel?
Thank you so much



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Excel IF function help

Thank you for your reply-

When do I want this action to happen? Whatever is easiest - at open or with
a button or key.

I have a spreadsheet that is filled out. I need to make a matrix with nine
conditions. I have 2 columns with this data. It gets updated once a month or
so.

I wrote an earlier question to this group (search on "Need a MATRIX
diagram") that explains what I wanted to do. It didn't look do-able, so I'm
trying a different tack.

I'm needing the correlation between the 2 columns.

I hope this explains things - again I really appreciate your help.


"Harald Staff" wrote:

This can not be done with a formula, unless it resides in AA2. But then it
can't leave whatever AA2 value it has, because AA2 contains this formula,
not a value.

So you need a VBA macro to do this. My question is, before writing a
suggestion: When do you want this action to happen, and how does the values
change in F2 and J2 ?

Best wishes Harald

"DTTODGG" skrev i melding
...
Hello-

I need to write a statement similar to:

IF (F2 = 4 AND J2 = 4) then AA2 = "Northwest" else AA2 leave at whatever
value is currently there (no change)

IF (F2 <=2 AND J2 =4) then AA2 = "Northeast" else AA2 leave at whatever
value is currently there (no change)

How do I do this in excel?
Thank you so much




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Excel IF function help

I see.
I beluieve I'd approach that task with a formula like this in a spare
column:
=CHOOSE(F2,"C","C","B","A","A")&CHOOSE(J2,"C","C", "B","A","A")
it says C for 1 and 2, B for 3 and A for 4 and 5, and it's returning AA, CB,
AB, ... suitable for pivoting and subtotalling.

As for the VBA macro solution in mention, open the VB editor (Alt F11 or
similar), insert a module by menu Insert - Module. Paste this text into the
module:

Sub LoopSample()
Dim R As Long 'row number
For R = 2 To 500
If Cells(R, 6).Value = 4 Then
If Cells(R, 10) = 4 Then
Cells(R, 27).Value = "Northwest"
End If
End If
Next R
End Sub

Return to Excel and run it from the Tools - Macro - Run menu. Or put some
object onto your worksheet either from the Forms toolbar or the Drawing
toolbar, then rightclick it, select "assign macro" and assign the macro
LoopSample. Now the code runs when you click this object.

HTH. Best wishes Harald

"DTTODGG" skrev i melding
...
Thank you for your reply-

When do I want this action to happen? Whatever is easiest - at open or

with
a button or key.

I have a spreadsheet that is filled out. I need to make a matrix with nine
conditions. I have 2 columns with this data. It gets updated once a month

or
so.

I wrote an earlier question to this group (search on "Need a MATRIX
diagram") that explains what I wanted to do. It didn't look do-able, so

I'm
trying a different tack.

I'm needing the correlation between the 2 columns.

I hope this explains things - again I really appreciate your help.


"Harald Staff" wrote:

This can not be done with a formula, unless it resides in AA2. But then

it
can't leave whatever AA2 value it has, because AA2 contains this

formula,
not a value.

So you need a VBA macro to do this. My question is, before writing a
suggestion: When do you want this action to happen, and how does the

values
change in F2 and J2 ?

Best wishes Harald

"DTTODGG" skrev i melding
...
Hello-

I need to write a statement similar to:

IF (F2 = 4 AND J2 = 4) then AA2 = "Northwest" else AA2 leave at

whatever
value is currently there (no change)

IF (F2 <=2 AND J2 =4) then AA2 = "Northeast" else AA2 leave at

whatever
value is currently there (no change)

How do I do this in excel?
Thank you so much






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Excel IF function help

Harold - thank you SO much for your help. The solution worked beautifully and
saved me much time.

"Harald Staff" wrote:

I see.
I beluieve I'd approach that task with a formula like this in a spare
column:
=CHOOSE(F2,"C","C","B","A","A")&CHOOSE(J2,"C","C", "B","A","A")
it says C for 1 and 2, B for 3 and A for 4 and 5, and it's returning AA, CB,
AB, ... suitable for pivoting and subtotalling.

As for the VBA macro solution in mention, open the VB editor (Alt F11 or
similar), insert a module by menu Insert - Module. Paste this text into the
module:

Sub LoopSample()
Dim R As Long 'row number
For R = 2 To 500
If Cells(R, 6).Value = 4 Then
If Cells(R, 10) = 4 Then
Cells(R, 27).Value = "Northwest"
End If
End If
Next R
End Sub

Return to Excel and run it from the Tools - Macro - Run menu. Or put some
object onto your worksheet either from the Forms toolbar or the Drawing
toolbar, then rightclick it, select "assign macro" and assign the macro
LoopSample. Now the code runs when you click this object.

HTH. Best wishes Harald

"DTTODGG" skrev i melding
...
Thank you for your reply-

When do I want this action to happen? Whatever is easiest - at open or

with
a button or key.

I have a spreadsheet that is filled out. I need to make a matrix with nine
conditions. I have 2 columns with this data. It gets updated once a month

or
so.

I wrote an earlier question to this group (search on "Need a MATRIX
diagram") that explains what I wanted to do. It didn't look do-able, so

I'm
trying a different tack.

I'm needing the correlation between the 2 columns.

I hope this explains things - again I really appreciate your help.


"Harald Staff" wrote:

This can not be done with a formula, unless it resides in AA2. But then

it
can't leave whatever AA2 value it has, because AA2 contains this

formula,
not a value.

So you need a VBA macro to do this. My question is, before writing a
suggestion: When do you want this action to happen, and how does the

values
change in F2 and J2 ?

Best wishes Harald

"DTTODGG" skrev i melding
...
Hello-

I need to write a statement similar to:

IF (F2 = 4 AND J2 = 4) then AA2 = "Northwest" else AA2 leave at

whatever
value is currently there (no change)

IF (F2 <=2 AND J2 =4) then AA2 = "Northeast" else AA2 leave at

whatever
value is currently there (no change)

How do I do this in excel?
Thank you so much






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
Excel Data Validation/Lookup function does function correcty Kirkey Excel Worksheet Functions 2 May 25th 09 09:22 PM
copy of excel file not showing formulal/function in the function b oaallam Excel Discussion (Misc queries) 4 September 6th 07 01:20 PM
Adding a custom function to the default excel function list DonutDel Excel Programming 3 November 21st 03 03:41 PM
When I Import an Access Table With an Excel Function in a Cell it Displays as Text not as a Function in Excel Niek Otten Excel Programming 2 September 18th 03 03:55 AM
Excel - saving result of a function without showing the function Moshe Excel Programming 1 August 30th 03 08:41 PM


All times are GMT +1. The time now is 11:50 PM.

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

About Us

"It's about Microsoft Excel"