• 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

Hi ,

I would have thought you would take up the challenge.

A .xlsm file means there is a macro ; if you can click on macros , you should be able to see which macro needs to be run.

Narayan



So sorry, I am up for it but tired LOL, yes this is how I want it to work Narayan. Can I just load all my other game rows to this sheet? Is there a way to have them run and all go to say sheet 2 and can I do one for E's and O's too?

Once again, THANK YOU!!!!!!
 
Hi Jack ,

At present the code is just hiding the unwanted rows ; some more code will be needed to transfer the result rows to another sheet. As far as Es and Os are concerned , no change needs to be made to the code. A named range Search_Pattern has been given to the cell AM2 ; whatever is entered in this cell will be taken as the search pattern.

Narayan
 
Hi Jack ,

At present the code is just hiding the unwanted rows ; some more code will be needed to transfer the result rows to another sheet. As far as Es and Os are concerned , no change needs to be made to the code. A named range Search_Pattern has been given to the cell AM2 ; whatever is entered in this cell will be taken as the search pattern.

Narayan
I copied 1500 rows to this sheet and ran the macro with placing a UDDD in cell AM2, it only found 1 game which was a few rows down and stopped. What am I doing wrong or what do I need to do to search the whole sheet?
 
Hi Jack-P-Winner,

It sounds like we're looking for game combinations that have that Criteria pattern somewhere within the combination. Then, we want to copy all of those records, plus the record of the game above (1 game number higher) to a different sheet.

If the above paragraph is correct, this example should help. Criteria is enetered in cell A2. The hlper columns in AM:AN figure out what lines match, and I've got an Event macro setup automatically fire when you change A2.
 

Attachments

  • ExampleCombos.xlsm
    27.8 KB · Views: 7
A
Hi Jack-P-Winner,

It sounds like we're looking for game combinations that have that Criteria pattern somewhere within the combination. Then, we want to copy all of those records, plus the record of the game above (1 game number higher) to a different sheet.

If the above paragraph is correct, this example should help. Criteria is enetered in cell A2. The hlper columns in AM:AN figure out what lines match, and I've got an Event macro setup automatically fire when you change A2.
Almost there .... WOW!!! I typed in a UDDD and this is what I got on the output page
 

Attachments

  • output sheet UD.png
    output sheet UD.png
    23.5 KB · Views: 8
A

Almost there .... WOW!!! I typed in a UDDD and this is what I got on the output page
And that's....bad?
18 was a match, so 19 comes. 15 is a match, so 16 comes, and so on for 9 and 5. Is this not the correct output, or do you want the layout changed somehow?
 
Y
And that's....bad?
18 was a match, so 19 comes. 15 is a match, so 16 comes, and so on for 9 and 5. Is this not the correct output, or do you want the layout changed somehow?


Yes good and bad LOL MY search was for UDDD

okay, look at 18 UDDD and 19 DUDD, 15 is UDUD and we are looking for UDDD, 9 is UUDD which is not UDDD, and 5 and 6 is correct. When I look for say UDDD I ONLY want the ones to come up in that order ONLY. Maybe that was not clear?
 
No, 15 is UDUDDD
Or, is the criteria not "search value cound anywhere in combo", but instead, should only be found at the beginning?
 
No, 15 is UDUDDD
Or, is the criteria not "search value cound anywhere in combo", but instead, should only be found at the beginning?
yes BUT my criteria that I was looking for was for a 4 letter which would be UDDD the 5th and 6th letter would not be used in this instance.

okay, I explained this earlier. I look for 3 different sets of letters which are 4,5 and 6 letter groups . For EXAMPLE: UUDD, UUUDD, UDUDUD. When I copy and paste the 2500 games onto a sheet I will only be copying ONE of these groups to sort. In the above in 15 UDUDDD I was only entering UDDD for my search therefore I would have to look at the start which would be UDUD. Does this make sense? I know this has got to be difficult trying to do what others think so thank you for your patience
 
If my statement above is true, helper column 2 formula should be:
=OR(LEFT(AM4,LEN(CritCell))=CritCell,LEFT(AM5,LEN(CritCell))=CritCell)

Again, the confusion was just from terminology. SEARCH within XL means to look at whole cell contents and look anywhere within it, but you only want to look at the beginning. I think I've got it now, though.
 
If my statement above is true, helper column 2 formula should be:
=OR(LEFT(AM4,LEN(CritCell))=CritCell,LEFT(AM5,LEN(CritCell))=CritCell)

Again, the confusion was just from terminology. SEARCH within XL means to look at whole cell contents and look anywhere within it, but you only want to look at the beginning. I think I've got it now, though.


but instead, should only be found at the beginning?
 
and then I just copy and paste the code onto a new sheet with the 2500 games or copy and paste the 2500 games to the one you do I and I download?
 
I'd copy your information into the workbook I uploaded, so you don't have to copy the VB and named ranges. You will need to copy the helper formula cells down as needed. Since we were still working on what the exact problem was, I didn't get too fancy. :DD
 
Are you serious sir or just making fun at me? LOL
Hi, Jack-P-Winner!
Do you think that I'd be capable of doing such a thing? Oh, my God...
Give a look to this image from your file, and tell me wtf are the matches in rows 4, 8 and 20 for the pattern UUDDUU. I'm thinking on betting 2 jackpots...
Regards!
PS: wtf stands for where the fooling, of course.Look for U\'s and D\'s in a pattern within several rows (for Jack-P-Winner at chandoo.org).png
 
Thank goodness I thought WTF was where's the fiber LOL, I should specialty ROWS and Game numbers and you will get what you deserve sir WHEN I win (-: I ALWAYS keep my promise and I will be able to afford to buy a plane ticket to personally deliver you yours on that tropic island you live on or plan to live on LOL
 
Here is an example of a sheet that I had to copy and paste each one by one. I am looking for EOEO. Even though there are 5 letters and I am concerned with the 5th letter, my goal is to find all the EOEO and the game above it. I know this makes sense to someone that can help me with a macro. This is so time consuming
Hi, Jack-P-Winner!
But first you have to answer this:
Hi, Jack-P-Winner!
Do you think that I'd be capable of doing such a thing? Oh, my God...
Give a look to this image from your file, and tell me wtf are the matches in rows 4, 8 and 20 for the pattern UUDDUU. I'm thinking on betting 2 jackpots...
Regards!
PS: wtf stands for where the fooling, of course.View attachment 3244
Otherwise I don't know what you're talking about and I'll go on with my Rosetta's decryption or with my advanced Antique Mandarin course, they're much easier.
 
n
I'd copy your information into the workbook I uploaded, so you don't have to copy the VB and named ranges. You will need to copy the helper formula cells down as needed. Since we were still working on what the exact problem was, I didn't get too fancy. :DD


Not being familiar with helper programs and before Sir tells me how smart I am again, where exactly to I put the
=OR(LEFT(AM4,LEN(CritCell))=CritCell,LEFT(AM5,LEN(CritCell))=CritCell) and where/what do I drag down for the 2500 games kind Luke (-:
 
Formula would go in cell AN4.
Once you have all the real data in place, would need to copy cells AM4:AN4 as far down as needed.

If you right-click on the sheet tab, view code, you'll see my macro. You may need to adjust these lines:
'Filter the range based on criteria
Me.Range("$AN$3:$AN$2500").AutoFilter field:=1, Criteria1:="TRUE"
'Copy the cells to Output Worksheets
Range("A3:AK2500").SpecialCells(xlCellTypeVisible).Copy Worksheets("Output").Range("A1")

So that the 2500 is some arbitrary number larger than the number of Excel Rows (not games) you have.
 
Otherwise I don't know what you're talking about and I'll go on with my Rosetta's decryption or with my advanced Antique Mandarin course, they're much easier.
Hi, Jack-P-Winner!
Decrypted Rosetta, advanced to 2nd level of Mandarin, and then gave a look to the file again... and gotcha!
The "rows" are the game numbers... o_O
Regards!
 
Formula would go in cell AN4.
Once you have all the real data in place, would need to copy cells AM4:AN4 as far down as needed.

If you right-click on the sheet tab, view code, you'll see my macro. You may need to adjust these lines:
'Filter the range based on criteria
Me.Range("$AN$3:$AN$2500").AutoFilter field:=1, Criteria1:="TRUE"
'Copy the cells to Output Worksheets
Range("A3:AK2500").SpecialCells(xlCellTypeVisible).Copy Worksheets("Output").Range("A1")

So that the 2500 is some arbitrary number larger than the number of Excel Rows (not games) you have.

I must have something out of place Luke, its not running correctly for me. It runs but its picking up the entire row for example. I want to find DDDDU and it finds DDDDUD and DDDDDD not just the rows with DDDDU
 
Last edited:
can you look at my file and tell me why its not working?
Hi, Jack-P-Winner!

Give a look at this file:
https://dl.dropboxusercontent.com/u...ok 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!
 
Back
Top