Solved

Excel: Add $ Signs to Formula in a Single Column

Posted on 2011-09-15
6
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 50
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 (Microsoft MVP / EE MVE) 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 33

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
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

628 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