Formula reference to never dissapear

kalcerro_1

New Member
Joined
Feb 28, 2020
Messages
27
Office Version
  1. 365
Platform
  1. Windows
Hello,

I need help with one question.

I have a formula in a cell: =count.if('4.JiraResult'$D$5:$D$3000;TechAsseRes!K4) but sometimes, the reference sheet: "4.JiraResult" will not always be present and a #¡REF! can appear.
Is there a way to enter a formula, so the formula can be updated when the sheet "4.JiraResult" appear in the current workbook.

The current workbook is working with a macro and I can consider work with a macro if necessary.

Thank you, In advance!
Karin.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Try this macro in the code module for ThisWorkbook. When you open the workbook, it will check if the sheet exists. If it does exist, it will place the formula in A1 of "Sheet1". Change the sheet name and range to suit your needs.
VBA Code:
Private Sub Workbook_Open()
    If Evaluate("isref('" & "4.JiraResult" & "'!A1)") Then
       Sheets("Sheet1").Range("A1").Formula = "=countif('4.JiraResult'$D$5:$D$3000;TechAsseRes!K4)"
    End If
End Sub
 
Upvote 0
Solution
Thank you @mumps very useful answer and in fact is working good. How can I change the code to create the formula in automatic mode (in a specific cell in tab"TechAsseRes" when the tab: "4.JiraResults" appear. I mean, in the module ThisWorkbook works great, but this excel tool is creating the tab "4.JiraResults" in the moment the user is moving on and changing values.

Thank you very much for your support!
Try this macro in the code module for ThisWorkbook. When you open the workbook, it will check if the sheet exists. If it does exist, it will place the formula in A1 of "Sheet1". Change the sheet name and range to suit your needs.
VBA Code:
Private Sub Workbook_Open()
    If Evaluate("isref('" & "4.JiraResult" & "'!A1)") Then
       Sheets("Sheet1").Range("A1").Formula = "=countif('4.JiraResult'$D$5:$D$3000;TechAsseRes!K4)"
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

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