+ Reply to Thread
Results 1 to 3 of 3

Naming a Range with Spaces

  1. #1
    Forum Contributor
    Join Date
    02-14-2011
    Location
    West Valley City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    108

    Naming a Range with Spaces

    I'm currently working with data validation and I'm having an issue finding the right function to replace a space in my data. For example: Column A is a non dependent list with Basketball, Soccer, and Baseball. Column B is dependent on Column A so that when Column A says Basketball, Column B has a dropdown of John Stockton and Carl Malone. In column C I want a dropdown dependent on Column B so if John Stockton is chosen it says Game nights that he played. The issue I am having is naming a data range John Stockton with a space in it. Right now im using the function =INDIRECT(SUBSTITUTE(C19," ","_",1) where C19 is where John Stockton would be and I am trying to replace the space (" ") with an underscore, as that is what I have named the hidden data names. Any ideas on what the correct function would be?

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Naming a Range with Spaces

    Hi Sky188 and welcome to the forum,

    I think you have a valid way of replacing a space with underscore. With a small sample worksheet uploaded, perhaps there is a different way to get the second pulldown to work better. It might take some filters or VBA code, but let us look.

    To upload a file, click on "Go Advanced" under the message area and then the PaperClip Icon above the message area. This will open a window asking for a file to attach.

    I like basketball.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Naming a Range with Spaces

    Quote Originally Posted by Sky188 View Post
    Right now im using the function

    =INDIRECT(SUBSTITUTE(C19," ","_",1)

    where C19 is where John Stockton would be and I am trying to replace the space (" ") with an underscore, as that is what I have named the hidden data names.

    Any ideas on what the correct function would be?
    The function above is ok in theory assuming there is only 1 space in C19 (no leading/trailing spaces).

    However, assuming single space, the above will still fail to work if the referenced range (John_Stockton) is itself Dynamic - this is a standard limitation of INDIRECT.

    If the RefersTo for John_Stockton includes OFFSET, INDIRECT or a range:INDEX approach then I'm afraid you can't use INDIRECT to handle it.

    In these instances you will need to either:

    a) use an IF or CHOOSE based construct in the Data Validation Source in C

    b) use Evaluate (old XLM call) via another Name and reference this new name in C

    Attached is a basic example of these methods
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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