Solved

Excel: Add $ Signs to Formula in a Single Column

Posted on 2011-09-15
6
291 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
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…

831 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