.formula doesn't create the desired formula in a cell

pingme89

Board Regular
Joined
Jan 23, 2014
Messages
172
Office Version
  1. 365
Platform
  1. Windows
I have the following line of code that should place a formula in a cell.
VBA Code:
ThisWorkbook.Worksheets("Log").Range("AA1").Formula = "=IFERROR(UNIQUE(FILTER(Log!$E$2:$E$100, Log!$E$2:$E$100<>" & Chr(34) & Chr(34) & ")), " & Chr(34) & Chr(34) & ")"

The desired formula result should be: =IFERROR(UNIQUE(FILTER(Log!$E$2:$E$100, Log!$E$2:$E$100<>"")), "")

However, what I actually get is : =@IFERROR(UNIQUE(FILTER(Log!$E$2:$E$100, Log!$E$2:$E$100<>"")), "")

If I manually go into the cell and remove the "@" symbol, the formula works. How can I put that formula into the cell without manual intervention for it to work?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try...
Rich (BB code):
ThisWorkbook.Worksheets("Log").Range("AA1").Formula2 =
 
Upvote 1
Solution
That worked. But why? What is Formula2 and when do I use it?
 
Upvote 0
Maybe the article in the link below will help explain
 
Upvote 0
@pingme89
I suggest that you update your forum profile (click your user name at the top right of the forum, then ‘Account details’) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

It would make it easier for helpers to know to suggest things like .Formula2 as that is not applicable to all versions.
 
Upvote 0
That was very insightful. Thank you for your knowledge.
 
Upvote 0

Forum statistics

Threads
1,215,328
Messages
6,124,299
Members
449,149
Latest member
mwdbActuary

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