+ Reply to Thread
Results 1 to 5 of 5

eliminate a certain combination of letter and number

  1. #1
    Registered User
    Join Date
    06-08-2020
    Location
    New York USA
    MS-Off Ver
    MS Office Pro
    Posts
    2

    eliminate a certain combination of letter and number

    Hello,

    I am wondering if its possible to eliminate a certain combination of letter and number.

    Ok So this is my worksheet.

    I have:
    Column A1: =\\ (CHAR(RANDBETWEEN(66,73))) // giving me input Letters B to I randomly
    Column B1: =\\ (RANDBETWEEN(1,8)) // giving me input Letters 1 to 8 randomly
    Column C1: =\\ =A1&" "&B1 // Which is the combination of A1 and B1

    However, I do not want cell C1 to compute certain value such as "A1." But I still want the letter A and the number 1 to be within the range of the random input

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: eliminate a certain combination of letter and number

    Welcome to the forum.

    So what do you want to be returned in C if A contains A and B contains 1?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: eliminate a certain combination of letter and number

    Hi, welcome to the forum.
    Maybe this is a solution:
    Please Login or Register  to view this content.
    where a1 can be between 65 and 73
    Cheers
    Erwin
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  4. #4
    Registered User
    Join Date
    06-08-2020
    Location
    New York USA
    MS-Off Ver
    MS Office Pro
    Posts
    2

    Re: eliminate a certain combination of letter and number

    Thank you for the welcome.

    I do not C1 to give the input of B1 B2 but i want it to input B3 B4 B5. I do not want to take B away as a possibility

  5. #5
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: eliminate a certain combination of letter and number

    So you've got an 8*8=64 outcome space. And some combinations thereof are invalid.

    So the way I'd do it is create all those 64 combos down a column -- A1, A2, A3, ... I8-- and then go back and delete out whatever combos are invalid.
    And then however long that range of cells is (50 cells? 55? whatever) set up a RAND that generates that many results as an integer, and run that as an index position to return from the range of valid results.

    The other way to do it is to generate your 8*8 results, then compare that against a lookup table for "invalid" results, and either return a null for invalid or do a recalc, but that's starting to get into recursion and anyway I'm not sure it's the best thing to do.

    So I think your best result would be to create a linear array of allowable results and then just feeding a random number into a position lookup in the array.

    You could make it a little more sophisticated by having all 64 results and then a helper cell with a manual Boolean switch for whether it's included, and then use that to create a helper column that only includes allowable entries as the index for your random lookup. And you could automate the array creation by telling it how many letters and numbers to include and then having it march down with ROW to fill it out or whatever.
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

+ 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. Replies: 9
    Last Post: 05-15-2019, 10:55 AM
  2. [SOLVED] Subracting numbers with a letter combination
    By Poppyhead66 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 06-15-2015, 02:48 AM
  3. Combination of letter and numbers in a column
    By aminkov1991 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-14-2015, 04:04 PM
  4. Format issue with changing a number letter combination to a date
    By Newbiedine in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-13-2014, 01:34 AM
  5. combination of letter to form new string
    By mqcai4613 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2014, 10:11 AM
  6. Replies: 12
    Last Post: 12-13-2013, 04:29 PM
  7. Need Validation formula for a Letter Number Combination
    By Talo in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 11-19-2012, 12:22 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