• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Look for U's and D's in a pattern within several rows

Once again, THANK YOU sir. Hmmm my VBA experience is minimal with ZERO training, instructions or anything besides youtube and forums I've just recently have even learned what a Macro is and what it does. I've learned formulas and had ALOT of help putting things together, trial and error and deleting ..... Redoing a ton of worksheets getting about two hrs of sleep a day. Why you may ask? I WANT THAT JACKPOT! Lol. I have things to do and places to go lol plus I have to go visit you when I win and have a glass of champagne or two with you. I will drop my grandson off at daycare, get off this iPad and check this out. THANK YOU Sir!
 
You are me HERO, I guess I will have to buy you a bottle of champagne to go a long with you % of my earnings kind sir. I have played around with this and like it VERY MUCH. If I can get something added Sir. I have to be able to see what the NEXT row up is. So, If my pattern is DUDUDU in Game 1452 I would like to see what is in Game 1451. What happens NEXT is the key. As you know I am looking for predictions in to the future with my crystal ball LOL. Why can't I just find that Almanac like Michael J Fox buys in Back to the Future? Hmmmm can you work on that for me too? LOL


Hi, Jack-P-Winner!

Give a look at this file:
https://dl.dropboxusercontent.com/u/60558749/Look for U's and D's in a pattern within several rows - UD Look up (for Jack-P-Winner at chandoo.org).xlsm

Trying to repair my unforgivable error of haven't understood your workbook at once and more indeed having doubted from your assertions, and considering your concerns about VBA code and its placement, I built a workbook that contains basically 1 worksheet and 1 module:
- worksheet Parameters
- module Módulo1

It's supposed (as far as I tested) to let you fill the proper values in worksheet Parameters, then press the cyan button and an output worksheet with the matching rows would (should!) be created in the indicated place.

Parameters are:
- Input WB: workbook where the data to be analyzed is located (if left empty, this workbook is assumed)
- Input WS: worksheet of Input WB with the data (if left empty, 1st worksheet (for other workbooks) and 2nd worksheet (for this workbook) is used
- Title row: now no. of titles, if any (if left empty, no title is assumed)
- Column no.: "columns" (in your jargon) or "groups of six columns" (in Excel)
- Start row: if left empty, 1st of data range is assumed
- Start column: if left empty, 1st of data range is assumed
- Pattern valid: 2 characters indicating the accepted values (in the sample, DU)
- Pattern search: string to be matched (of length less or equal than column no.)
- Output WB: workbook where the output worksheet is going to be created/updated (if left empty, this workbook is assumed)
- Output WS: worksheet of output WB with the output data (if left empty, input WS plus "_Out" is assumed

It has all the validations that I thought could be included to guarantee the proper functioning, but maybe I missed something. Check this too and advise.

I tested it with many patterns from your worksheet Sheet1 (which is included in the workbook) and created the output in the same workbook. For me it works fine, but of course it's you who have the last word.

The idea is that the workbook (without) data worksheet may be used to take a worksheet from any workbook and create a result worksheet in any workbook, including the actual one: this workbook. I only checked the behavior with this workbook, so I don't know how it works with other workbooks, it should even create a new workbook if the chosen doesn't exist. While I test this tomorrow, you might want to play with the known proved "in-workbook" form, using your actual worksheet Sheet1 or any other one.

Give it a try and let me know how it goes.

Regards!
 
As a bonus for me LOL I would like a formula or code that will add my game numbers up individually to the lowest denomination? What I am looking for is say game 2069+=2+0+6+9=17=1+7=8 game 2047=2+0+4+7=13=1+3=4 game 2053 =2+0+5+3=10=1+0=1 game 2070=2+0+7+0=9 I think you see what I mean. Ideally would be in column B with bright Green font Bold of course size 12 LOL, I know you love my details with colors and No I am not a rainbow warrior. I am a proud lesbian for 52 years LOL. I guess this would be sort of a converter and if I ned to do another post I can do that do. Again THANK YOU sir.

Your suggestions for me .... a starting place to learn about Macros and this stuff? I NEED to slow down and tae some time to learn all of this. I just do not find the time to do so. Getting temporary custody of my grandson 5 weeks ago has slowed my game time down tremendously but he is a blessing and a cutie pie. Now, If I can only get my daughter to get her life in order ... soon I hope.....
 
@Jack-P-Winner
Not sure if it can be done with regular formulas, but here's a UDF for the game number reduction. Copy this code into a regular module in the Visual Basic Editor (VBE)
Code:
Function ReduceNum(MyNum As Single) As Integer
Dim newTot As Single
Dim i As Integer

i = 0
Do Until MyNum < 10 ^ i
    i = i + 1
    newTot = newTot + Mid(MyNum, i, 1)
Loop
If newTot > 9 Then newTot = ReduceNum(newTot)
   
ReduceNum = newTot
End Function
Then, close the VBE. In your workbook, you can now use it just like a regular function, and do something like:
=ReduceNum(A5)
 
@Jack-P-Winner
Not sure if it can be done with regular formulas, but here's a UDF for the game number reduction. Copy this code into a regular module in the Visual Basic Editor (VBE)
Code:
Function ReduceNum(MyNum As Single) As Integer
Dim newTot As Single
Dim i As Integer
 
i = 0
Do Until MyNum < 10 ^ i
    i = i + 1
    newTot = newTot + Mid(MyNum, i, 1)
Loop
If newTot > 9 Then newTot = ReduceNum(newTot)
  
ReduceNum = newTot
End Function
Then, close the VBE. In your workbook, you can now use it just like a regular function, and do something like:
=ReduceNum(A5)


@Luke

okay, I saved this to the VBE module and enabled Macros. I copy and pasted =ReduceNum(A5) in cell A5 and dragged it down to 10 for example. Now what do I do?
 
That should be it, don't need to "do" anything...once it's copied into the VBE module, it's just like writing a regular formulas. Oh wait! I see the problem.

Don't put the formula in A5 and reference A5. The cell reference inside the formula should be where the Game number is. So, if game number is in A5, then in cell B5, put this formula:
=ReduceNum(A5)
 
For Luke, here is the file from Sir, feel free to jump in LOL I am need to see the game that follows the one I am looking for. Example Game `1450 and Game 1451, Game 9 and Game 10. It does not happen much but according to my wife all the time BUT I was wrong what I said a few post up. I need the NEXT game not the one before. I always need to see what is going to happen NEXT so where is my crystal ball?
 

Attachments

  • Look for U\'s and D\'s in a pattern within several rows - from Sir).xlsm
    372.5 KB · Views: 3
For the first bit, the code was in the wrong place. Need to put it in a regular module, not a sheet module. See this image for guidance. In the Explorer window, you'll see the module that I've already created, and it also shows how to Insert the module. In your workbook, you'll need to Insert a module and then cut/paste the code.
RegularModule.png
 
I think I've managed to combine SirJB7 excellent work, the ability to bring over the next game, and my ReduceNum function. :DD
 

Attachments

  • Example U and D.xlsm
    506.2 KB · Views: 7
@SirJB7
No uploading of file to forum?? You like teasing me with my CASFFML issues?? :(
@Luke M
Hi, dad!
Wrong, man, it's the forum who has not only that but these illnesses:
- Filenames longer than 100 chars cannot be uploaded (and I'm not gonna change my filing policies)
- Files greater than 1Mb cannot be uploaded
- Zip files are allowed but not Rar (who uses WinZip still? and I don't like 7-zip, so why not WinRar?)
- ... and the list follows.
Regards!
 
Hey you guys, I will not kiss either of you and you should be glad but what I will do is :) I will play around with this for a while in-between baby feeds and just going duh after a cup of java but so far......once again, you amaze me!!! I may have a numerology challenge for you and also a way for you to make some nice moolah with the lotto when we are done or should I say you are done with it and I explain what to do with the outcome (-:

I have been testing something look hand and like what I see so far
 
Hi, Jack-P-Winner!
You are me HERO, I guess I will have to buy you a bottle of champagne to go a long with you % of my earnings kind sir.
Dom Perignon or Crystal, I guess. :cool:
BTW, when you said a bottle you meant a box, didn't you?
I have played around with this and like it VERY MUCH. If I can get something added Sir. I have to be able to see what the NEXT row up is. So, If my pattern is DUDUDU in Game 1452 I would like to see what is in Game 1451. What happens NEXT is the key. As you know I am looking for predictions in to the future with my crystal ball LOL.
As I wrote earlier in this thread, I entered late in the game so I'm a bit lost "como perro en cancha de bochas" (like dog in bocce court, I don't know if it makes sense in English but in Spanish it really does), i.e. almost lost at all. So I'll have to read it many times and hope to understand it.
In the meanwhile could you elaborate a bit as if you were explaining to a child of five (Groucho's dixit).
As a bonus for me LOL I would like a formula or code that will add my game numbers up individually to the lowest denomination? What I am looking for is say game 2069+=2+0+6+9=17=1+7=8 game 2047=2+0+4+7=13=1+3=4 game 2053 =2+0+5+3=10=1+0=1 game 2070=2+0+7+0=9 I think you see what I mean. Ideally would be in column B with bright Green font Bold of course size 12 LOL, I know you love my details with colors and No I am not a rainbow warrior. I am a proud lesbian for 52 years LOL.
This, I got it at a first glance! So I'm not so dumb, ha...
And regarding your last phrase, we have a lot in common: I like women a lot! ;). But I hate competition, you know, so either stop grabbing market share, or start sharing it! :p
52 years... wow! that's more than half a century, I remember as if it were yesterday when my father told me that some day I'll reach half a century. So you should have gone to elementary school with these guys:
http://chandoo.org/forum/threads/hijri-date-conditional-formatting.14047/#post-83268
Your suggestions for me .... a starting place to learn about Macros and this stuff? I NEED to slow down and tae some time to learn all of this. I just do not find the time to do so. Getting temporary custody of my grandson 5 weeks ago has slowed my game time down tremendously but he is a blessing and a cutie pie. Now, If I can only get my daughter to get her life in order ... soon I hope.....
As you well wrote learning anything demands available time, learning VBA isn't a once time process that you do it and then it's over. Nothing farther than that, it's a on going task that needs to be accomplished frequently to become proficient (for not saying awesome, as that guy motto). If you think that you can dedicate the required time to this, go on, otherwise I'd recommend you to wait and see.
Regards!
 
I think I've managed to combine SirJB7 excellent work, the ability to bring over the next game, and my ReduceNum function. :DD
Hi, Luke M!
I can't see what you've done regarding the next game (which BTW I don't understand what OP wants), so could you please enlighten my ignorance darkness with a drop of your wisdom?
Regards!
 
You are funny Sir LOL, hmmm share huh? I never share my car nor my wife. Other things we can discuss and I will get a you a case
 
Hi, Jack-P-Winner!
I got that about the sum of digits reduced to its lowest denomination (aka modulo 10, but I don't understand at all that about the next game issue.
Don't need do send anyone to fetch a child of five, here I am, so explain it to me.
Regards!
PS: If your car isn't a Bronco '80s or a Pontiac GTO '60s-'70s, unless it's a super 4x4 or a Mercedes AMG 6.3 or so, I appreciate your gesture, but thanks, I pass.
 
okay, for starters I have a GT Mustang LOL and love it. What I am saying on the next game is actually the game before the one I m looking for for example. If I am looking for game 1250 I want to see 1250 and 1251
 
Hi, Jack-P-Winner!
Wheh I see a starter I'll tell him that a newbie has a go-kart toy, just in case he'd be interested.
My internal child of five doesn't realize what do you mean by "If I am looking for game 1250 I want to see 1250 and 1251". Where do you want to see them?, in the new filtered worksheet, in the same row aside, before and after the original... make your best effort, you're supposed to be able.
Regards!
 
Hi, Jack-P-Winner!
Which are the rows originally selected? So as I can see which others were added as next ones. And those before, there're none, I guess.
Regards!
 
It will change from game to game Sir. I will enter the series I am looking for ie DDDDUU. This code goes out and finds all the DDDDUU and gives me al the games that will come after the DDDUU
 
Hi, Jack-P-Winner!
Could you do this?
Take my uploaded file, replace worksheet by your actual one, enter any pattern as you want, generate the results, and for the 1st 5 or 10 rows of results write down the additional rows that you want to get, as in the following structure, 5 columns:
Matching Row / Before Row / Where / Next Row / Where
Include those 5 columns in a new worksheet and better indeed build a column with all the rows for those 5 or 10 matches, in the order as you'd like to get them.
Regards!
 
I c
Hi, Jack-P-Winner!
Could you do this?
Take my uploaded file, replace worksheet by your actual one, enter any pattern as you want, generate the results, and for the 1st 5 or 10 rows of results write down the additional rows that you want to get, as in the following structure, 5 columns:
Matching Row / Before Row / Where / Next Row / Where
Include those 5 columns in a new worksheet and better indeed build a column with all the rows for those 5 or 10 matches, in the order as you'd like to get them.
Regards!

Nothing attached Sir and it looks like your combined effort with Luke is working out just fine
 
Back
Top