+ Reply to Thread
Results 1 to 9 of 9

RegEx - references & ranges from formula

  1. #1
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    RegEx - references & ranges from formula

    RegEx is still a world of mystery to me but I use a function cotaining RegEx which could be helpfully modified
    (credit ExtendOffice)

    The function returns a string of cell references separated by commas
    I would prefer 2 functions each returning a sub-set of those references
    - specifically ranges AND individual cells
    - the string should include sheet references if in the original formula

    Examples
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Function returns: A1, AA1:AA10, $AA1:$AA10, $AA$1:$XEP$20000
    Required RANGES: AA1:AA10, $AA1:$AA10, $AA$1:$XEP$20000
    Required CELLS: A1

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Function returns: DataTab!A1, DataTab!AA1:AA10, DataTab!$AA1:$AA10, DataTab!$AA$1:$XEP$20000
    Required RANGES: DataTab!AA1:AA10, DataTab!$AA1:$AA10, DataTab!$AA$1:$XEP$20000
    Required CELLS: DataTab!AA1

    My current workaround is to manipulate the resultant string, but it would be tidier if each function generated the string required.

    Thank you

    Please Login or Register  to view this content.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: RegEx - references & ranges from formula

    Please Login or Register  to view this content.
    Last edited by jindon; 01-14-2018 at 08:31 AM.

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: RegEx - references & ranges from formula

    Thank you jindon

    The function works perfectly for ranges where the formula contains a sheet reference

    BUT....
    returns nothing for formula where reference is in the SAME sheet
    example
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    should return
    AA1:AA10, $AA1:$AA10, $AA$1:$XEP$20000

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: RegEx - references & ranges from formula

    Just considered 2nd result.

    change pattern to
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: RegEx - references & ranges from formula

    That is perfect for RANGES - Thank you

    Could you now give me the pattern that does exactly the same for individual cell references

    with formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    function should return
    A1,A2,DataTab!A1,DataTab!A2,DataTab!E2,Sheet1!F2
    Last edited by kev_; 01-15-2018 at 02:57 AM.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: RegEx - references & ranges from formula

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: RegEx - references & ranges from formula

    @jindon - thank you - it is very close

    with formula
    =A1+A2+DataTab!A1+VLOOKUP(DataTab!A2,DataTab!C2:D12,DataTab!E2,Sheet1!F2)

    function returns:
    A1, A2, DataTab!A1, DataTab!A2, DataTab!C2:D12, DataTab!E2, Sheet1!F2

    this is what I want:
    A1,A2,DataTab!A1,DataTab!A2,DataTab!E2,Sheet1!F2

    There should be no ranges in the string

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: RegEx - references & ranges from formula

    Then
    Please Login or Register  to view this content.
    Last edited by jindon; 01-15-2018 at 04:56 AM.

  9. #9
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: RegEx - references & ranges from formula

    @jindon - thank you - that is exactly what I wanted

+ 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 MAX formula to include column references from changing ranges
    By PeteABC123 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-11-2016, 04:36 PM
  2. [SOLVED] Absolute References using Named Ranges?
    By AstToTheRegionalMGR in forum Excel General
    Replies: 5
    Last Post: 02-10-2015, 01:59 PM
  3. Relative References Named Ranges
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-07-2015, 03:14 PM
  4. [SOLVED] index match array formula - replace cell references with ranges
    By nigelog in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-17-2014, 10:39 AM
  5. IF Statement Using Cell Ranges & References
    By RMH in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-27-2013, 03:40 AM
  6. Excel 2007 : References to ranges
    By Johnny Fix in forum Excel General
    Replies: 5
    Last Post: 09-16-2011, 02:59 AM
  7. RegEx type formula?
    By shaysedai32 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2011, 02:56 PM

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