convert string to a formula

doug firr

Board Regular
Joined
Mar 28, 2011
Messages
140
I have a column, actually of screen resolutions with thousands of rows that look something like this:

[TABLE="width: 64"]
<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"]943*530[/TD]
[/TR]
[TR]
[TD="class: xl65"]953*572[/TD]
[/TR]
[TR]
[TD="class: xl65"]969*768[/TD]
[/TR]
[TR]
[TD="class: xl65"]986*1236[/TD]
[/TR]
[TR]
[TD="class: xl65"]999*599[/TD]
[/TR]
</tbody>[/TABLE]

I would like to know the screen area hence add "=" in front of each value.

I did this using concatenate but it just displays the forumla (e.g. "=943*530) and does not in fact do any calculation.

How do I get around this to show the calculated values?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi,

Assuming your data is in column A, the following macro will do as you require

Code:
Sub a()
Dim rCell As Range

For Each rCell In Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
rCell.Offset(0, 1).Formula = "=" & rCell.Value
Next

End Sub
 
Upvote 0
Thanks VoG. That works but I was hoping for a means of just converting the string to the formula, something like "=toformula". I encounter this frequently and wondered if anyone knew of anything along those lines
 
Upvote 0
Thanks VoG. That works but I was hoping for a means of just converting the string to the formula, something like "=toformula". I encounter this frequently and wondered if anyone knew of anything along those lines

You can do this in 2 steps

Assuming data starts in A1

1) In the adjacent cell put ="^"&A1, drag down to end of data range.

2) Highlight the entire column then type Ctrl+F (Find & Replace window): >Find what: ^ >Replace with: = >Replace All.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top