Solved

Excel: Add $ Signs to Formula in a Single Column

Posted on 2011-09-15
6
265 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:teylyn
Comment Utility
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
Comment Utility
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:
teylyn earned 500 total points
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 31

Expert Comment

by:Rob Henson
Comment Utility
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:teylyn
Comment Utility
... sometimes the simple things are buried under all the curly thoughts. Good one, Rob.
0
 

Author Closing Comment

by:u002dag
Comment Utility
Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

772 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

14 Experts available now in Live!

Get 1:1 Help Now