Inserting a Relative Formula into Cells

mayoung

Active Member
Joined
Mar 26, 2014
Messages
257
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I have the the following two formulas I would like to insert into a spreadsheet using a macro into cells G18:G31 and I18:I31. either through using a range, auto fill or copy/paste,
I need the formulas to be relative as relate to each reference cell 18,19,20 etc.

My problem is getting the correct formula to recognize the formula due to the select one.

Cell G18: =IF(COUNTIF(J18,"*SELECT ONE*"),"",F18*K18)

Cell I18: =IF(COUNTIF(J18,"*SELECT ONE*"),"",G18+H18)

Any Help would be appreciated.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Try:

VBA Code:
Range("G18:G31").Formula = "=IF(COUNTIF(J18,""*SELECT ONE*""),"""",F18*K18)"

Follow same convention for the 2nd one.
 
Upvote 0
Try:

VBA Code:
Range("G18:G31").Formula = "=IF(COUNTIF(J18,""*SELECT ONE*""),"""",F18*K18)"

Follow same convention for the 2nd one.

When I enter the code I get this error? (see attached picture.)
 

Attachments

  • 2020-01-27 (1).png
    2020-01-27 (1).png
    167.5 KB · Views: 6
Upvote 0
WHat formula is in F18 and K18? If you say OK to that message, which cell does it refer to as containing the circular reference?
 
Upvote 0
WHat formula is in F18 and K18? If you say OK to that message, which cell does it refer to as containing the circular reference?

I figured it out. Your formula worked I just forgot to change my cell range on the second formula.

Thank You!!
 
Upvote 0

Forum statistics

Threads
1,214,992
Messages
6,122,631
Members
449,095
Latest member
bsb1122

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