Solved

Excel: Add $ Signs to Formula in a Single Column

Posted on 2011-09-15
6
280 Views
Last Modified: 2012-05-12
Hi,
I have one column of equations that needs to have fixed references. There are 700 rows though. How can I non-manually add these $ signs.

=IF(A7<>"", HYPERLINK($AH$7, $AG$7), "") Correct
=IF(A8<>"", HYPERLINK($AH$8, $AG$8), "") Correct
=IF(A9<>"", HYPERLINK($AH9, AG9), "") Needs three $ signs added
=IF(A10<>"", HYPERLINK($AH10, AG10), "") Needs three $ signs added

Thanks,
Dennis
0
Comment
Question by:u002dag
  • 3
  • 2
6 Comments
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 36547119
Hello,

just a question: If the formulas (as they are right now) point to the correct cells, why do you want to change the references to absolute?

What is the rationale behind that need? What would be different if the references were absolute? What problem would that solve?

Maybe there is a different approach to the overall issue.

cheers, teylyn
0
 

Author Comment

by:u002dag
ID: 36547161
Hi Teylyn,
Thanks for asking. The actual goal is to be able to sort the data in A7:G700.
Unfortunately, column G is full of hyperlink formula like you see above.
I tried various forms of pasting in the value into this column but after a number of questions on EE, I failed.
I have found that this approach works, it will just take me all night to manually type in the $ signs.

What do you think?
EOS-Assistant.xls
0
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst earned 500 total points
ID: 36547273
Hmm. Maybe not the best design, if you first refer to cells in the same row and then only sort the left half of the sheet.

The following macro will turn all references in formulas residing in F7:F100 to absolute references. But that will also include the reference to column E, i.e. you will end up with


=IF($A$7<>"", HYPERLINK($AH$7, $AG$7), "")
=IF($E$8<>"", HYPERLINK($AH$8, $AG$8), "")
=IF($E$9<>"", HYPERLINK($AH$9, $AG$9), "")
=IF($E$10<>"", HYPERLINK($AH$10, $AG$10), "")
=IF($E$11<>"", HYPERLINK($AH$11, $AG$11), "")
=IF($E$12<>"", HYPERLINK($AH$12, $AG$12), "")

etc. If that does not present a problem, run this

Sub test()
  Dim oRange As Range

  Set oRange = Sheets("Sheet1").Range("F7:F100")

  oRange.Formula = Application.ConvertFormula(Formula:=oRange.Formula, fromreferencestyle:=Application.ReferenceStyle, toabsolute:=xlAbsolute)

End Sub

Open in new window


Create a backup copy of your file, copy the code, right-click the sheet tab, click View Code, paste the code, adjust the range in the code F7:F100 to the desired range and then hit F5 to run.

cheers, teylyn

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 32

Expert Comment

by:Rob Henson
ID: 36548421
One method:

Do an Edit Replace removing ALL $ signs, so in the Find & Replace window:
Find = $
Replace = "leave blank"

Then do 2 more Find & Replace:

Find = AH
Replace = $AH$

and

Find = AG
Replace = $AG$

Thanks
Rob H
0
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 36548430
... sometimes the simple things are buried under all the curly thoughts. Good one, Rob.
0
 

Author Closing Comment

by:u002dag
ID: 36551946
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now