ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to insert a formula? (https://www.excelbanter.com/excel-discussion-misc-queries/249550-how-insert-formula.html)

JoeF

how to insert a formula?
 
Hi: I have a collumn of #s such as 80 x 120 and 65 x 100, etc. I need the
actual product of them. I have replaced the "x" with "*" but cannot get the
"=" inserted. Can you suggest somethiong?

Gary''s Student

how to insert a formula?
 
Select the cells you want to convert and run this small macro:

Sub formulator()
For Each r In Selection
r.Formula = "=" & Replace(r.Value, "x", "*")
Next
End Sub

Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200909


"JoeF" wrote:

Hi: I have a collumn of #s such as 80 x 120 and 65 x 100, etc. I need the
actual product of them. I have replaced the "x" with "*" but cannot get the
"=" inserted. Can you suggest somethiong?


Jacob Skaria

how to insert a formula?
 
A1 = 80 x 120

In B1 try the formula
=LEFT(A1,SEARCH("x",A1)-1)*MID(A1,SEARCH("x",A1)+1,10)

OR Try this UDF (User Defined function). From workbook launch VBE using
Alt+F11. From menu Insert a Module and paste the below function.Close and get
back to workbook and try the below formula.

=evaltext(A1)

Function EvalText(strData As String) As Variant
EvalText = Evaluate(Replace(strData, "x", "*", 1, 1, vbTextCompare))
End Function


If this post helps click Yes
---------------
Jacob Skaria


"JoeF" wrote:

Hi: I have a collumn of #s such as 80 x 120 and 65 x 100, etc. I need the
actual product of them. I have replaced the "x" with "*" but cannot get the
"=" inserted. Can you suggest somethiong?


Jacob Skaria

how to insert a formula?
 
Cool...Better to specify text comparison so as to replace upper and lower
case X. ('X' and 'x')

r.Formula = "=" & Replace(r.Value, "x", "*",1,,vbTextCompare)

"Gary''s Student" wrote:

Select the cells you want to convert and run this small macro:

Sub formulator()
For Each r In Selection
r.Formula = "=" & Replace(r.Value, "x", "*")
Next
End Sub

Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200909


"JoeF" wrote:

Hi: I have a collumn of #s such as 80 x 120 and 65 x 100, etc. I need the
actual product of them. I have replaced the "x" with "*" but cannot get the
"=" inserted. Can you suggest somethiong?


Gary''s Student

how to insert a formula?
 
Good point.
--
Gary''s Student - gsnu200909


"Jacob Skaria" wrote:

Cool...Better to specify text comparison so as to replace upper and lower
case X. ('X' and 'x')

r.Formula = "=" & Replace(r.Value, "x", "*",1,,vbTextCompare)

"Gary''s Student" wrote:

Select the cells you want to convert and run this small macro:

Sub formulator()
For Each r In Selection
r.Formula = "=" & Replace(r.Value, "x", "*")
Next
End Sub

Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200909


"JoeF" wrote:

Hi: I have a collumn of #s such as 80 x 120 and 65 x 100, etc. I need the
actual product of them. I have replaced the "x" with "*" but cannot get the
"=" inserted. Can you suggest somethiong?



All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com