You can't use a UDF to insert a formula. I'm afraid you'll have to use an XLM macro to reference a range in a closed file. I found this information HERE
So in practice:
My testfile value:
The somewhat edited code:
Private Function GetValue(path, file, sheet, ref)
Dim arg As String
If Right(path, 1) <> "\" Then path = path & "\"
If Dir(path & file) = "" Then
GetValue = "File Not Found"
Exit Function
End If
arg = "'" & path & "[" & file & "]" & sheet & "'!" & Range(ref).Range("A1").Address(, , xlR1C1)
GetValue = ExecuteExcel4Macro(arg)
End Function
Sub TestGetValue()
With ActiveWorkbook.Sheets(1)
path = .Cells(1, 3)
file = .Cells(2, 3)
sheet = .Cells(3, 3)
ref = .Cells(4, 3)
.Cells(1, 1) = GetValue(path, file, sheet, ref)
End With
End Sub
Use a button and assign macro to run on click