Would anyone be able to explain why a formula doesn’t work when I use a concatenate but works when I don’t.

Carty

Board Regular
Joined
Mar 3, 2009
Messages
76
Hi

This should be simple but I am finding it baffling

The formula that works:
Code:
=Match(B4,'\\network address\folder\[file.xlsx]sheet'!$E:$E,)
I get the result 12. My understanding is that this is the row which the value of B4 on the current sheet is found in column E on the specified (different) sheet.

However I would like to use a cell reference on the current sheet to determine the sheet on which to look by using
Code:
=Match(B4,Concatenate("'\\network address\folder\[file.xlsx]",D4&" Text","'!",”$E:$E”),)
It gives me a #VALUE error and I don’t know why.

Stripping out the Concatenate part of the formula it gives me, I believe, the correct format i.e.

Code:
=Concatenate("'\\network address\folder\[file.xlsx]",D4&" Text","'!",”$E:$E”),)
Gives me '\\network address\folder\[file.xlsx]D4 Text'!$E:$E where "D4 Text" is the sheet name, which matches the format in the formula above.

Any enlightenment gratefully received

Thanks

Paul
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
8,952
Because when you explicitly defined the workbook path and name, it was an address, and Excel was able to resolve it. When you use CONCATENATE, you are creating a text string, not an address. It looks like an address, but it's not. In order to convert a text to an address, you can surround it with the INDIRECT function. However, more bad news, INDIRECT does not work on closed workbooks. In order to do what you want, you may need to use VBA in some form.
 

Carty

Board Regular
Joined
Mar 3, 2009
Messages
76
Thank you, Eric W, for enlightening me. Not so much for creating more problems ;)
 

Forum statistics

Threads
1,081,439
Messages
5,358,681
Members
400,508
Latest member
fish31

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top