ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Add formula if (https://www.excelbanter.com/excel-discussion-misc-queries/245903-add-formula-if.html)

puiuluipui

Add formula if
 
Hi, i need a macro to add a formula starting from "H2", but only if in "F"
colum are numbers.
Ex:
F H
12 formula
5 formula
empty no formula

If there are some numbers in "F" column, then to add formula in in "H"
column starting from "H2".
This is the formula: =IF(G2<"",H2*G2,"")
Can this be done?
Thanks!

Luke M

Add formula if
 
First, that creates a circular reference (formula is in H2 and references
H2!) Is this intended?

Second, would this formula work?
=IF(ISBLANK(G2),"",H2*G2)

If not, you'd need to use a Workbook_Change event. You could prb modify one
of the previous example someone has posted for you on one of your other
threads.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"puiuluipui" wrote:

Hi, i need a macro to add a formula starting from "H2", but only if in "F"
colum are numbers.
Ex:
F H
12 formula
5 formula
empty no formula

If there are some numbers in "F" column, then to add formula in in "H"
column starting from "H2".
This is the formula: =IF(G2<"",H2*G2,"")
Can this be done?
Thanks!


puiuluipui

Add formula if
 
Hi Luke, thanks for everything, but i need something like this.:
Intersect(ActiveSheet.UsedRange.Columns("G").Speci alCells(2).EntireRow,
Columns("I2")).FormulaR1C1 = "=IF(RC[-2]<"""",RC[-1]*RC[-2],"""")"

This macro is working ok, but i need to start looking and adding from row 2.
This macro is working from the begining of the columns. I need the macro to
work from row 2.
Can this be done?
Thanks!

"Luke M" wrote:

First, that creates a circular reference (formula is in H2 and references
H2!) Is this intended?

Second, would this formula work?
=IF(ISBLANK(G2),"",H2*G2)

If not, you'd need to use a Workbook_Change event. You could prb modify one
of the previous example someone has posted for you on one of your other
threads.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"puiuluipui" wrote:

Hi, i need a macro to add a formula starting from "H2", but only if in "F"
colum are numbers.
Ex:
F H
12 formula
5 formula
empty no formula

If there are some numbers in "F" column, then to add formula in in "H"
column starting from "H2".
This is the formula: =IF(G2<"",H2*G2,"")
Can this be done?
Thanks!



All times are GMT +1. The time now is 08:30 PM.

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