Community
Wiki Posts
Search

Excel question

Thread Tools
 
Search this Thread
 
Old Dec 6, 2006 | 9:43 pm
  #1  
Original Poster
FlyerTalk Evangelist
All eyes on you!
20 Years on Site
 
Join Date: Feb 2005
Location: RSE
Programs: AA Exp|VA Platinum
Posts: 15,913
Question Excel question

Hi

This is probably a little OT but I'm trying to do a new price list and am wondering if is there anyway that you can have two cells interdependant on eachother....

ie I have a cell called "Sale Price" and another called "Mark-up". Currently prices are done off Markup, (Sale Price= Markup*Cost Price). Is there anyway that you can either change "Sale Price" or "Markup" and the other will change, so I could either set the mark up or the sale price and the other would fill?

Thanks
bensyd is offline  
Old Dec 6, 2006 | 10:11 pm
  #2  
 
Join Date: Nov 2004
Location: SYD
Programs: QF Plat & Lifetime Gold, Velocity Gold, SQ PPS
Posts: 247
Originally Posted by bensyd
This is probably a little OT but I'm trying to do a new price list and am wondering if is there anyway that you can have two cells interdependant on eachother....
That is called a circular reference which Excel won't allow.
DI542 is offline  
Old Dec 6, 2006 | 10:30 pm
  #3  
Original Poster
FlyerTalk Evangelist
All eyes on you!
20 Years on Site
 
Join Date: Feb 2005
Location: RSE
Programs: AA Exp|VA Platinum
Posts: 15,913
Originally Posted by DI542
That is called a circular reference which Excel won't allow.

Ahh I had a feeling I was out of luck...No real way around it either.
bensyd is offline  
Old Dec 6, 2006 | 10:48 pm
  #4  
A FlyerTalk Posting Legend
Community Builder
Community Influencer
All eyes on you!
25 Years on Site
 
Join Date: Feb 2001
Location: Berkeley, CA USA
Programs: Piggly Wiggly "Shop the Pig!" Preferred Shopper
Posts: 60,660
Have you considered whether using conditionals ("IF") might work for you? Take a look at the IF function in the help menu and see if you might be able to use it for your situtation.
dhuey is offline  
Old Dec 6, 2006 | 11:30 pm
  #5  
Original Poster
FlyerTalk Evangelist
All eyes on you!
20 Years on Site
 
Join Date: Feb 2005
Location: RSE
Programs: AA Exp|VA Platinum
Posts: 15,913
Originally Posted by dhuey
Have you considered whether using conditionals ("IF") might work for you? Take a look at the IF function in the help menu and see if you might be able to use it for your situtation.
I have but I would still end up with a circular ref, wouldn't I? Unless I created a third point....I'll have to investigate.
bensyd is offline  
Old Dec 6, 2006 | 11:58 pm
  #6  
 
Join Date: Jul 2006
Location: LAX
Programs: UA 1P MM, SPG Lifetime Gold
Posts: 654
Try having 2 sets of the 3 columns (Sale price, Markup, and Cost). One set is your data entry set and the other would have IF formulas. You should then be able to enter any 2 of the 3 and have the 3rd calculated, with the other 2 carried over.
PCTraveler is offline  
Old Dec 7, 2006 | 4:19 am
  #7  
Original Poster
FlyerTalk Evangelist
All eyes on you!
20 Years on Site
 
Join Date: Feb 2005
Location: RSE
Programs: AA Exp|VA Platinum
Posts: 15,913
Originally Posted by PCTraveler
Try having 2 sets of the 3 columns (Sale price, Markup, and Cost). One set is your data entry set and the other would have IF formulas. You should then be able to enter any 2 of the 3 and have the 3rd calculated, with the other 2 carried over.

Thats done the trick thanks. Is there anyway now I can get the numbers in the data entry set to update to the data in the IF formulas as in if i enter say m/up and cost and it fills the fields in the "IF formulas columns" can I get it to reverse back and fill the blank sale price cell in the data entry set or is this circular???

thanks for all you help everyone
bensyd is offline  
Old Dec 7, 2006 | 10:04 am
  #8  
 
Join Date: Oct 2004
Location: Atlanta
Programs: Delta Silver, UA Premier, National Executive, Hilton Gold
Posts: 265
Check out http://www.mrexcel.com/board2/

I've gotten a lot of questions answered there.
t-rev is offline  
Old Dec 7, 2006 | 11:33 am
  #9  
A FlyerTalk Posting Legend
Community Builder
Community Influencer
All eyes on you!
25 Years on Site
 
Join Date: Feb 2001
Location: Berkeley, CA USA
Programs: Piggly Wiggly "Shop the Pig!" Preferred Shopper
Posts: 60,660
Originally Posted by bensyd
...thanks for all you help everyone
Our pleasure -- just pass the favor on to someone else when you can be of help.
dhuey is offline  
Old Dec 7, 2006 | 3:26 pm
  #10  
 
Join Date: Nov 2000
Posts: 7,700
Originally Posted by t-rev
Check out http://www.mrexcel.com/board2/

I've gotten a lot of questions answered there.
There's a discussion board for everything...
Mikey likes it is offline  
Old Dec 7, 2006 | 4:45 pm
  #11  
30 Countries Visited
1M
All eyes on you!
15 Years on Site
 
Join Date: Apr 2006
Location: CO hublette
Programs: UA AU MM,HH Diamond,Hyatt Globalist , Marriott Gold
Posts: 2,316
Well, there is kind of a way to do it with just the three columns (Sale Price, Markup and Cost).

A formula will give you the circular reference, but you can use VBA code to get around that.

if you were to write a macro on the worksheet, under the Change event you can do it. For example, the data you are trying to manipulate is on a sheet called Margin which is the first sheet in the workbook.

If you open the VBA editor (F11) then double click on Microsoft Excel Objects, Sheet1(Margin) and change the lefthand dropdown from General to Worksheet, then change the righthand dropdown to Change you will get the lines below in Blue. Put the lines in Red between the others, and anytime you make a change on that worksheet, this macro runs. (note, there are three lines that will turn green in VBA, they are the comments)

Private Sub Worksheet_Change(ByVal Target As Range)
Dim intSalePriceColumn As Integer
Dim intMarkupColumn As Integer
Dim intCostColumn As Integer
' determining which columns have the data
For x = 1 To 256
If Cells(1, x) = "Sale Price" Then intSalePriceColumn = x
If Cells(1, x) = "Markup" Then intMarkupColumn = x
If Cells(1, x) = "Cost" Then intCostColumn = x
Next x
' if you have just changed the sale price, calculate the markup
If ActiveCell.Column = intSalePriceColumn Then
Cells(ActiveCell.Row - 1, intMarkupColumn) = FormatPercent(Cells(ActiveCell.Row - 1, intSalePriceColumn) / Cells(ActiveCell.Row - 1, intCostColumn), 1, vbTrue, vbTrue)
End If
' if you have just changed the markup, calculate the sale price
If ActiveCell.Column = intMarkupColumn Then
Cells(ActiveCell.Row - 1, intSalePriceColumn) = FormatCurrency(Cells(ActiveCell.Row - 1, intMarkupColumn) * Cells(ActiveCell.Row - 1, intCostColumn))
End If

End Sub
trm2 is offline  


Contact Us - Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service -

This site is owned, operated, and maintained by MH Sub I, LLC dba Internet Brands. Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Designated trademarks are the property of their respective owners.