MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 29th, 2002, 07:06 PM   #1
toc63
New Member
 
Join Date: Apr 2002
Posts: 4
Default

THANKS FOR TAKING THE TIME TO READ MY LETTER.

NOW RIGHT TO THE QUESTION.

WHEN USING AN "IF" FUNCTION.

WHAT I WOULD LIKE TO DO IS GET THE VALUE OF A CELL WHEN TRUE, AND KEEP THE THE LAST VALUE OF THE CELL WHEN IT GOES FALSE.

THE TRUE PART IS EASY, BUT I CAN'T GET THE FALSE PART.

EXAMPLE:

CELL A2 HAS EITHER A VALUE OF 1 OR 0 IN IT DEPENDING ON OTHER ARGUMENTS
CELL A3 IS A VARIABLE BETWEEN 1 AND 120 AND CHANGES DEPENDING ON OTHER ARGUMENTS

CELL A1 IS MY "IF" FUNCTION
IF A2=1
IF TRUE A1=A3 A1 CHANGING AS A3 CHANGES

NOW HERES WHAT I WOULD LIKE
IF FALSE A1=WHAT A3 EQUALED JUST BEFORE A1 WENT FALSE, AND HOLDING THAT VALUE UNTIL A1 GOES TRUE AGAIN

CAN YOU HELP ME????

THANKS

Thomas O'Connor
39 Fairchild dr.
Amherst N.Y. 14226
toc63@earthlink.net
toc63 is offline   Reply With Quote
Old Apr 29th, 2002, 07:09 PM   #2
Anne Troy
MrExcel MVP
 
Anne Troy's Avatar
 
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
Default

What you want to accomplish isn't possible the way you describe.

Why don't you tell us a *real-life* scenario, and we can probably help better.
__________________
~Anne Troy
Anne Troy is online now   Reply With Quote
Old Apr 29th, 2002, 07:38 PM   #3
brettvba
MrExcel MVP
 
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
Default

Quote:
On 2002-04-29 18:06, toc63 wrote:
THANKS FOR TAKING THE TIME TO READ MY LETTER.

NOW RIGHT TO THE QUESTION.

WHEN USING AN "IF" FUNCTION.

WHAT I WOULD LIKE TO DO IS GET THE VALUE OF A CELL WHEN TRUE, AND KEEP THE THE LAST VALUE OF THE CELL WHEN IT GOES FALSE.

THE TRUE PART IS EASY, BUT I CAN'T GET THE FALSE PART.

EXAMPLE:

CELL A2 HAS EITHER A VALUE OF 1 OR 0 IN IT DEPENDING ON OTHER ARGUMENTS
CELL A3 IS A VARIABLE BETWEEN 1 AND 120 AND CHANGES DEPENDING ON OTHER ARGUMENTS

CELL A1 IS MY "IF" FUNCTION
IF A2=1
IF TRUE A1=A3 A1 CHANGING AS A3 CHANGES

NOW HERES WHAT I WOULD LIKE
IF FALSE A1=WHAT A3 EQUALED JUST BEFORE A1 WENT FALSE, AND HOLDING THAT VALUE UNTIL A1 GOES TRUE AGAIN

CAN YOU HELP ME????

THANKS

Thomas O'Connor
39 Fairchild dr.
Amherst N.Y. 14226
toc63@earthlink.net

you would have to store the original value somewhere else for it to pick it up
brettvba is offline   Reply With Quote
Old Apr 29th, 2002, 08:15 PM   #4
Jay Petrulis
MrExcel MVP
 
Jay Petrulis's Avatar
 
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
Default

Hi,

Delete the formula in A1. Enter the following code in the sheet module.

'--------
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$3" Then
If Target.Offset(-1, 0) = 1 Then Target.Offset(-2, 0) = Target
End If
End Sub
'---------

Question: What happens if A2 = 0 and then changes to 1 (true) but A3 doesn't change? In the above, nothing happens. If that needs to be added, let us know.

Bye,
Jay
Jay Petrulis is offline   Reply With Quote
Old Apr 29th, 2002, 08:24 PM   #5
Schrödinger’s cat
New Member
 
Join Date: Apr 2002
Posts: 18
Default

Quote:
On 2002-04-29 18:06, toc63 wrote:

NOW HERES WHAT I WOULD LIKE
IF FALSE A1=WHAT A3 EQUALED JUST BEFORE A1 WENT FALSE, AND HOLDING THAT VALUE UNTIL A1 GOES TRUE AGAIN

meow

[ This Message was edited by: Schrödinger’s cat on 2002-04-29 20:03 ]
Schrödinger’s cat is offline   Reply With Quote
Old Apr 30th, 2002, 05:53 PM   #6
toc63
New Member
 
Join Date: Apr 2002
Posts: 4
Default

JAY

I TRIED YOUR CODE BUT IT ONLY SEEMS TO WORK IF I ENTER THE VALUE BY HAND. I NEED TO BE ABLE TO GET THE VALUE FROM ANOTHER CELL.

THANKS AGAIN
TOM
toc63 is offline   Reply With Quote
Old Apr 30th, 2002, 06:00 PM   #7
Jay Petrulis
MrExcel MVP
 
Jay Petrulis's Avatar
 
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
Default

Hi Tom,

No need to SHOUT!

What formula is in cell A3? The event trigger can be changed to include the reference cells that comprise the formula, or another way may be found (have to think about that one).

Bye,
Jay
Jay Petrulis is offline   Reply With Quote
Old May 1st, 2002, 09:01 AM   #8
toc63
New Member
 
Join Date: Apr 2002
Posts: 4
Default

Jay

Sorry about the shouting, it's just how I type.

I was hoping to do this without boring you with specifics.

the formulas are as folows:
in cell E7 I have =INDIRECT(E3)
in cell E3 i have =ADDRESS(E1,2,1,1)
in cell E1 I have a spin button inserting a value between 1 and 1000

in cell F7 I have =INDIRECT(F3)
in cell F3 I have =ADDRESS(F1,3,1,1)
in cell F1 I have =E1

referencing our previous messages
A3=F7
A2=E7

columb 2 has variables from 1 to 20
columb 3 has variables from 0 to 1000
The variables are not in any order and can be repeated several times.

Thank You
Tom
toc63 is offline   Reply With Quote
Old May 1st, 2002, 09:17 AM   #9
Jay Petrulis
MrExcel MVP
 
Jay Petrulis's Avatar
 
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
Default

Quote:
On 2002-05-01 08:01, toc63 wrote:
Jay

Sorry about the shouting, it's just how I type.

I was hoping to do this without boring you with specifics.

the formulas are as folows:
in cell E7 I have =INDIRECT(E3)
in cell E3 i have =ADDRESS(E1,2,1,1)
in cell E1 I have a spin button inserting a value between 1 and 1000

in cell F7 I have =INDIRECT(F3)
in cell F3 I have =ADDRESS(F1,3,1,1)
in cell F1 I have =E1

referencing our previous messages
A3=F7
A2=E7

columb 2 has variables from 1 to 20
columb 3 has variables from 0 to 1000
The variables are not in any order and can be repeated several times.

Thank You
Tom
Hi Tom,

It appears that E1 is the cell that will trigger the change event.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$1" Then
If Range("E7") = 1 Then Range(???) = Range("F7")
End If
End Sub

Please fix the reference that I am missing (actually correct any that are wrong, of course). I am not following exactly which cell is the original A1.

HTH,
Jay
Jay Petrulis is offline   Reply With Quote
Old May 1st, 2002, 09:17 AM   #10
Asala42
Board Regular
 
Join Date: Feb 2002
Location: Southfield,MI USA
Posts: 1,030
Default

Hey all,

You could use an intentional circular reference.

Start with setting A2=1 and go to Tools/Options/Calculation and enable Iterations (otherwise you'll get nasty circular reference warnings).

in A1: =IF(A2=1,A3,A1)

That should do it,
Adam

Asala42 is offline   Reply With Quote
Reply

Bookmarks

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

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

Forum Jump


All times are GMT -4. The time now is 02:53 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes