+ Reply to Thread
Results 1 to 13 of 13

part of path imported from cell value

  1. #1
    Registered User
    Join Date
    06-02-2014
    Posts
    88

    part of path imported from cell value

    Hi,
    I would like bolded part of following path to be imported from N5 cell. Can you help to provide me with relevant formula?

    ='J:\ISO\01_ISO\07_Audity wewnetrzne\2015\Karty niezgodnosci\[NCR_FINACI_20150115_1200 - Etap 1.xlsm]DCT_ISOFOR_SC_8.02_NCR'!$I$8



    Regards,
    Marcin

  2. #2
    Forum Expert cbatrody's Avatar
    Join Date
    04-15-2014
    Location
    Dubai
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    2,136

    Re: part of path imported from cell value

    Hi,

    Welcome to the Forum.

    Please use the following formula:

    =MID(N5,FIND("[",N5,1)+1,(FIND("]",N5,1)-FIND("[",N5,1)-1))

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: part of path imported from cell value

    I think you will have to resort to XL4MACRO functionality for this, as being a formula, you cannot use standard text functions to extract sections of text.

    1. Create a named range called "CellN5Path". In the refers to box, enter =GET.CELL(6,$A$25)

    2. Use the formula supplied by cbatrody above to extract the partial path, ie

    =MID(CellN5Path,FIND("[",CellN5Path,1)+1,(FIND("]",CellN5Path,1)-FIND("[",CellN5Path,1)-1))
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Registered User
    Join Date
    06-02-2014
    Posts
    88

    Re: part of path imported from cell value

    Thank you for your replies.
    It seems, I expressed my intentions in wrong way.



    So assuming that N5 = NCR_FINACI_20150115_1200 - Etap 1.xlsm

    I would like to keep:
    ='J:\ISO\01_ISO\07_Audity wewnetrzne\2015\Karty niezgodnosci\[&=N5&]DCT_ISOFOR_SC_8.02_NCR'!$I$8

    Instead of:
    ='J:\ISO\01_ISO\07_Audity wewnetrzne\2015\Karty niezgodnosci\[NCR_FINACI_20150115_1200 - Etap 1.xlsm]DCT_ISOFOR_SC_8.02_NCR'!$I$8

    It seemed to be easy, but I spent hours trying to solve this issue

  5. #5
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: part of path imported from cell value

    That's a touch easier

    =INDIRECT("'J:\ISO\01_ISO\07_Audity wewnetrzne\2015\Karty niezgodnosci\["&N5&"]DCT_ISOFOR_SC_8.02_NCR'!$I$8")

  6. #6
    Registered User
    Join Date
    06-02-2014
    Posts
    88

    Re: part of path imported from cell value

    I have tried in this way as well, but unfortunately it does not work (#REF!).
    Is there any other funtion that might be used?

  7. #7
    Registered User
    Join Date
    06-02-2014
    Posts
    88

    Re: part of path imported from cell value

    Quote Originally Posted by Marcin4111 View Post
    I have tried in this way as well, but unfortunately it does not work (#REF!).
    Is there any other funtion that might be used?
    It might be easier to find a solution with attached document. For simulation it is required to determine the path.
    DCT_ISOFOR_SC_ 9.02 Rejestr kart niezgodności_audity wew.2015.xlsm
    Formula is required to cell D5

    Regards,
    Marcin
    Last edited by Marcin4111; 06-11-2014 at 11:15 AM.

  8. #8
    Registered User
    Join Date
    06-02-2014
    Posts
    88

    Re: part of path imported from cell value

    Quote Originally Posted by Marcin4111 View Post
    It might be easier to find a solution with attached document. For simulation it is required to determine the path.
    Attachment 324631
    Formula is required to cell D5

    Regards,
    Marcin
    Guys,
    Do you have any idea how to solve it?

  9. #9
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: part of path imported from cell value

    Is the path that you're referencing definitely correct? Is the referenced workbook open?

  10. #10
    Registered User
    Join Date
    06-02-2014
    Posts
    88

    Re: part of path imported from cell value

    Path is correct, but referenced workbook is closed and that's the problem... INDIRECT does not work for closed workbooks. It works with INDEX/MATCH, but there I couldn't provide with dynamic filename.

    I tried with macro, so with google I developed something that forks for individual cell:
    Sub PullValue()
    Dim PATH, FILENAME, SHEETNAME, CELL

    PATH = "J:\ISO\01_ISO\07_Audity wewnętrzne\2015\Karty niezgodności\"
    FILENAME = Range("M5")
    SHEETNAME = "DCT_ISOFOR_SC_9.02_2015"
    CELL = "I8"

    With Range("C5")
    .Formula = "='" & PATH & "[" & FILENAME & "]" & SHEETNAME & "'!" & CELL & ""
    .Value = .Value
    End With

    End Sub



    I tried to develope macro that works dynamically for all column, so what I wish:
    Sub PullValue()
    Dim PATH, FILENAME, SHEETNAME, CELL

    PATH = "J:\ISO\01_ISO\07_Audity wewnętrzne\2015\Karty niezgodności\"
    FILENAME = Range("M5")
    SHEETNAME = "DCT_ISOFOR_SC_9.02_2015"
    CELL = "I8"

    With Range("C5")
    .Formula = "='" & PATH & "[" & FILENAME'(M5:M204 switched for relevant range C5:C204) & "]" & SHEETNAME & "'!" & CELL & ""
    .Value = .Value
    End With

    End Sub



    So the only dynamic should be FILENAME.
    Could you please to provide me with modified macro?

    Regards,

  11. #11
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: part of path imported from cell value

    So, to be clear, you want the macro to populate each cell in column C with a formula that refers to a workbook defined in the same row in column M?

  12. #12
    Registered User
    Join Date
    06-02-2014
    Posts
    88

    Re: part of path imported from cell value

    Excactly, assuming:

    There are 4 factors required for simulation:
    PATH - static
    FILENAME - dynamic required
    SHEET - static
    CELL - static

    Dynamic values for FILENAME are defined in Range("M5:M204")

    Formula should cover Range("C5:C204")
    .Formula = "='" & PATH & "[" & FILENAME 'dynamic values & "]" & SHEETNAME & "'!" & CELL & ""

  13. #13
    Registered User
    Join Date
    06-02-2014
    Posts
    88

    Re: part of path imported from cell value

    Finally solved! Thanks for advices

    Sub PullValue_daniel()
    Dim PATH, FILENAME, SHEETNAME, CELL
    Dim wrs As Integer

    PATH = "J:\ISO\01_ISO\07_Audity wewnętrzne\2015\Karty niezgodności\"
    SHEETNAME = "DCT_ISOFOR_SC_9.02_2015"
    CELL = "I8"

    wrs = 5

    Do While Cells(wrs, 13) <> ""
    FILENAME = Range("M" & wrs)

    With Range("C" & wrs)
    .Formula = "='" & PATH & "[" & FILENAME & "]" & SHEETNAME & "'!" & CELL & ""
    .Value = .Value
    End With

    wrs = wrs + 1
    Loop

    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need Help with Cell Value as part of Workbook path
    By joee0201 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-09-2014, 06:54 PM
  2. [SOLVED] reference part of cell address from button and part of another cell
    By JJGF in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-24-2012, 04:48 PM
  3. extracting part of imported data
    By jyin in forum Excel General
    Replies: 18
    Last Post: 03-28-2007, 11:39 AM
  4. [SOLVED] finding part of fole path
    By sheila in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-04-2005, 01:30 AM
  5. [SOLVED] Can I use a cell value as part of a link's path name?
    By Dave in forum Excel General
    Replies: 1
    Last Post: 10-04-2005, 04:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1