+ Reply to Thread
Results 1 to 5 of 5

Find a range of numbers based on first letter of adjacent cells

  1. #1
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Find a range of numbers based on first letter of adjacent cells

    Hi all!

    I have a list of vocabulary words in Excel. Currently I have all the words from A-Z in field B1 with their definitions in C1. In field A1, I have them numbered starting at 1. I want to section or group them off relative to their first letter in the alphabet. Though I do not want to physically move them from the whole group. I would like to use a function that will perform this action when called. I only need the lowest and highest numbers from the A1 field that relate to the words in B1, and from there I can probably figure out the rest..

    I'm having trouble figuring out what function will give me the range of a specific section, lets say words that begin with the letter "W".
    I need it to return the lowest and highest numbers from the "W" section using the numbers from A1. That way I can plug those numbers in my Random function which will then generate words from a specific group, rather than from the entire list

    Here is a rough example if that helps:

    ____A______B________C____
    1___1____Word1___Definition1
    2___2____Word1___Definition1

    I feel like most of this I can accomplish, I'm just stuck trying to figure out how to get the values that I will need to plug into the Rand function.

    If someone can just suggest a function to use, I'm sure I can figure out the rest.

    Thanks
    Mike

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find a range of numbers based on first letter of adjacent cells

    I only need the lowest and highest numbers from the A1 field that relate to the words in B1, and from there I can probably figure out the rest..
    Does the attached resemble what you want?
    Attached Files Attached Files
    Last edited by FlameRetired; 02-06-2015 at 11:22 PM.

  3. #3
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Re: Find a range of numbers based on first letter of adjacent cells

    Quote Originally Posted by FlameRetired View Post
    Does the attached resemble what you want?
    Thank you very much, yes that will work!

    I didn't even think about using an array to solve it. I was focused on trying to find a function to make it work. Duh, still trying to learn this stuff.

    Is there a better way in VB to plug my Min and Max values into my Rand UDF? Here is what I propose based on my limited knowledge (Notice the If Conditions are in pseudo-code for now):

    If E15 = “A” then MinValue = J2 and MaxValue = J3
    If E15 = ”B” then MinValue = K2 and MaxValue = K3

    RandomNumber = Int((MaxValue - MinValue + 1) * Rnd) + MinValue

    Is there a more efficient way to go through the alphabet than creating a IF Condition for each alphabet letter? Maybe similar to an array calculation, or can you perform array calculations in VB?

    Thanks again!
    Mike

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

    Re: Find a range of numbers based on first letter of adjacent cells

    Hi Mike,

    Perhaps a Pivot with Min and Max and a helper column would be useful? See the attached.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Forum Contributor
    Join Date
    05-16-2007
    Location
    USA
    MS-Off Ver
    MS Office 2016, Excel 2016
    Posts
    214

    Re: Find a range of numbers based on first letter of adjacent cells

    Quote Originally Posted by MarvinP View Post
    Hi Mike,

    Perhaps a Pivot with Min and Max and a helper column would be useful? See the attached.
    Thanks for the suggestion, but I wouldn't even know where to begin with using a Pivot table.

    I'm still learning and my training material has not covered anything regarding Pivot tables -- yet that is.

    Don't get me wrong, looking at the Pivot table looks like it could be helpful, but I wouldn't even know where to begin to make it work for me.

    Thanks
    Mike

+ 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. [SOLVED] Find all entries in a range and tally numbers based on codes in adjacent fields
    By reynastus2 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-07-2014, 10:28 PM
  2. [SOLVED] Find and Get Column Letter and Row Number from Duplicates in Range of Cells
    By WITJ in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2013, 12:23 PM
  3. Replies: 4
    Last Post: 10-01-2012, 10:58 AM
  4. Replies: 4
    Last Post: 05-12-2011, 04:37 PM
  5. Find and replace based on adjacent cells?
    By Leo328i6 in forum Excel General
    Replies: 3
    Last Post: 03-16-2011, 03:59 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