User Profile
steveccc
Brass Contributor
Joined Nov 28, 2019
User Widgets
Recent Discussions
Re: Filter rows by color, and copy/paste output using Excel VBA
Here's the answer I came up with. The key was finding a way to select a row with no data: Range("A" & Rows.Count).End(xlUp).Offset(1).Select Sub Macro4() ' ' Macro4 Macro ' Sheets("Output").Select Columns("H:H").Select Selection.AutoFilter ActiveSheet.Range("$H$1:$H$1000").AutoFilter Field:=1, Criteria1:=RGB(255, _ 255, 0), Operator:=xlFilterCellColor Range("A2:L2").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Sheets("Output2").Select Range("A1").Select ActiveSheet.Paste Sheets("Output").Select Application.CutCopyMode = False ActiveSheet.Range("$H$1:$H1000").AutoFilter Field:=1, Operator:= _ xlFilterNoFill Selection.Copy Sheets("Output2").Select Range("A" & Rows.Count).End(xlUp).Offset(1).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Output").Select Selection.AutoFilter Range("A2").Select Sheets("Output2").Select Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select End Sub3.9KViews0likes0CommentsFilter rows by color, and copy/paste output using Excel VBA
Hello, thanks for taking a look: Worksheet "Output" contains thousands of rows of names. In reality these names are unique, but for the attached example they are uniform. Some rows in Worksheet "Output" are highlighted, some are not. How do I copy paste all highlighted rows on Worksheet "Output" into Worksheet "Output2", and then right below that copy/paste all non highlighted rows on Worksheet "Output" into Worksheet "Output 2"? The total number of columns, rows, and number of highlighted rows and highlighted rows, will differ for each use. So I want the VBA to filter rows by color in Worksheet "Output", then copy, then paste into Worksheet "Output2". Worksheet "Example-of-desired-Output2" shows how I would like the VBA to paste in data into Worksheet "Output2".4.5KViews0likes3CommentsRe: Extract different player names referring to an identical text string into separate columns.
Hi Sergei, thanks. Just the fact you helped me one time is awesome. I don't expect people to respond to my questions quickly or even at all. When they do, it's just an amazing bonus.3.5KViews0likes1CommentRe: Delete Duplicate Rows With Text Arranged in Different Columns
I understand thanks. Was hoping there was an easy way to retain the original Row. So for example if we have this: Row 1: Apple Row 2: Apple Row 3: Orange After removing duplicates it would look like this: Row 1: Apple Row 2: Row 3: Orange That is, Row 2 would now be blank instead of deleted.5.4KViews0likes0CommentsRe: Extract different player names referring to an identical text string into separate columns.
SergeiBaklan Sergei, I took your latest player data extract example and tried to apply it to a third format. In column I, the player's name that is extracted has the last letter cut off (see attached). I tried modifying the code but couldn't figure it out. It seems like the issue is related to Cell S5, and the RIGHT function in the Column I formula, but I couldn't get it to work. How do I modify this so the last letter of the player name in Column I is not cut off? Thanks!3.5KViews0likes0CommentsRe: Extract different player names referring to an identical text string into separate columns.
SergeiBaklan Wow, this is great! Thanks very much. I took your instructions and updated the Excel file on my own (attached). While it did take a few minutes to complete on my desktop, it is a much preferred solution to anything I could do before.3.6KViews0likes7CommentsRe: Extract different player names referring to an identical text string into separate columns.
SergeiBaklan Hi Sergei. It seems like you are using NBA (basketball) player data as an example. But for this question, we should be using the NFL (football) player instead (please see attached). Your original formula solution for NBA player data worked because each player was referenced by a unique identifier. However, your formula solution for NFL player data does not work because the NFL data uses shared identifiers for each position. Let's look at the data in Cell B2 in the attached example of NFL player data: QB Carson Wentz RB Christian McCaffrey RB Miles Sanders WR Davante Adams WR DeVante Parker FLEX Alshon Jeffery WR Dede Westbrook TE Tyler Higbee DST Chiefs On the Excel worksheet, Identifiers are in D1:L1 Here is how the data appears in D2:L2 using your formulas: Carson Wentz R Christian McCaffrey RB Miles Sanders W Christian McCaffrey RB Miles Sanders W Davant Davant Davant Adams WR DeVante Parker F Alshon Jeffery WR Dede Westbrook TE Tyler Higbee D Chiefs Obviously this is not working properly. However, if there was a way to change the Column B data so that the shared identifiers (RB, RB, WR, WR, WR) are changed into unique names (RB 1, RB2, WR1, WR2, WR3), then your original formula solution would work. In summary, some kind of find/replace solution is needed for transforming the shared identifiers (RB, RB, WR, WR, WR) in Column B into unique identifiers (RB1, RB2, WR1, WR2, WR3).3.6KViews0likes9CommentsRe: Extract different player names referring to an identical text string into separate columns.
SergeiBaklan Sergei, is there an way to search and replace the separators with different names? I couldn't figure it out, but if so that would make your formula solution work. For example, Original data: QB Drew Brees RB Alvin Kamara FLEX Leonard Fournette RB Brian Hill WR DJ Moore WR Jarvis Landry WR Allen Hurns TE Jared Cook DST Broncos Data with new separators: QB Drew Brees RB1 Alvin Kamara FLEX Leonard Fournette RB2 Brian Hill WR1 DJ Moore WR2 Jarvis Landry WR3 Allen Hurns TE Jared Cook DST Broncos How to quickly change the name of the separators? Find/Replace does not work. I imagine it requires some combination of COUNT, AND, OR.3.6KViews0likes12CommentsRe: extract player names following text string references
SergeiBaklan Hello Sergei, I'm trying to follow your Power Query instructions above. I'm new to Power Query, so none of it is intuitive. Are you able to post more detailed instructions? I searched a few videos on YouTube and could not find anything directly relevant, so I thought I could ask you. If you have a YouTube channel, please let me know. Here is what I figured out on my own. Step 1: Source data is in B1:B151. In Excel worksheet, create a table of separators in D1:D10. Step 2: Highlight source data B1:B151. Goto Data drop down menu. Select "From Range / Table" This opens up Power Query. Step 3: Sadly, this is where I am stuck. How do I do this? "and with query add column to which transform separators, like "PG " => "* PG " If you have time, I'd love to get step by step instructions because I'm brand new to Power Query. Thanks for considering this!3.1KViews0likes3CommentsRe: Delete Duplicate Rows With Text Arranged in Different Columns
SergeiBaklan Thanks Sergei. I want to retain the original order of the lineups, and not sure how to do that with the solution you just posted. I took your worksheet from above, and concatenated the helper column data in Column R. Then I added a TRUE/FALSE helper column in Column S. (see attached). I know how to use filter to delete all the matches indicated by TRUE in column S. However, I don't understand how I can use that to clear duplicate lineup data in Columns A:H. I'm using the word "clear" intentionally. I don't want to delete the duplicate rows. I want to clear the data from the rows in order to retain the order in which the original data was inputted. Thanks for taking a look.5.4KViews0likes2CommentsExtract different player names referring to an identical text string into separate columns.
This is a variation of a previous question solved by Sergei Baklan posted here: https://techcommunity.microsoft.com/t5/Excel/extract-player-names-following-text-string-references/m-p/1039852#M45460 Mr. Baklan came up with a clever way to extract text following certain text references. Each text reference was different from the other. In this example, we have duplicate text references referring to more than one player. Here is the example of data found in one cell: QB Drew Brees RB Alvin Kamara FLEX Leonard Fournette RB Brian Hill WR DJ Moore WR Jarvis Landry WR Allen Hurns TE Jared Cook DST Broncos In this case, RB refers to two different players -- Alvin Kamara and Brian Hill. How do I adjust Sergei Baklan's work to take into account identical text referring to two different players? In the attached example, see the input in Column B and the output in Columns D:L. The formula is not properly returning data in Columns F, H, and I. Please see the attached.Solved4.1KViews0likes16CommentsRe: Delete Duplicate Rows With Text Arranged in Different Columns
CA_PUNIT_AGARWAL Hello, I've been testing the worksheet and ran into three issues. 1) False positives. For example, in the attached updated spreadsheet, a lineup in Row 82 and a lineup in Row 145 are not identical, but they have the same number in Column Q. I tried using the RAND function to make the numbers more uneven so less of a chance of matching, but I still get false positives. 2) Retain row structure. I don't want to use the "Remove Duplicates" function because it deletes the Row. I actually just want to clear all the data in that row. Look at Row 3 and Row 10 for example. Row 10 contained the duplicate lineup, and I cleared that row manually. 3) Speed. How do we do this quickly? I want to be able to filter and clear out these duplicate rows almost immediately. Thanks for your help!5.5KViews0likes0CommentsRe: Delete Duplicate Rows With Text Arranged in Different Columns
CA_PUNIT_AGARWAL Works perfectly, thank you! This is a very clever solution. I did not think about assigning numbers to text values. What I especially like about it is that it's simple enough for me to immediately understand and add to my skill set.5.5KViews1like6CommentsRe: Delete Duplicate Rows With Text Arranged in Different Columns
CA_PUNIT_AGARWAL Thanks CA_Punit. This is a clever solution. It works well when players are in the same column. But it does not work when they appear in different columns. Look at the teams in Row 105 and 106 for example -- they are identical. These two teams have the exact same players as one another -- but the players appear in a different order from one another (different column headers). Malik Monk appears in A105 and F106. James Harden appears in F105 and B106. Malcolm Brogdon appears in B105 and A106. The same 8 players in Row 105 appear in Row 106. They are in just different order. How can I filter out and delete Row 106, and others like it? Thanks!5.5KViews0likes9Comments
Recent Blog Articles
No content to show