Forum

❎ Seeking he...
 
Notifications
Clear all

Please register! If you are registered, please log inagain !
[NB: your old dvd forums / digitalfix login will not work]

❎ Seeking help with an Excel question 🆘

4 Posts (replies)
2 Users
2 Reactions
249 Views
Posts (replies): 4
Topic starter
(@dunkle)
New Member
Joined: 3 years ago

Not even sure I can explain this issue / question but I will try

Have a huge document, 1000s of lines of data across a dozen or so rows
Two of the rows, for want of a better / easier explanation tell a “story”

Now what I want is the ability for a user to filter the thousands of lines of data based on a number of “keywords” but different users woukd have different search criteria

I think macros are what’s likely needed but (a) don’t know how to create and (b) not sure how the users woukd run them

So, for example

User 1 would need to run a “macro” that looked in column j or k for various colours, so the keywords “blue”, “yellow”, “white”, “red”, “black”, “brown”

I’d want this named “colour search” and when run by the user, the data would filter based on one of those words showing just entries that have one of the colours needed. Ideally I would also like the “keyword” highlighted automatically in red

Then user 2 would need to run a “macro” that looked in column j or k for various items of cutlery , so the keywords “knife”, “spoon!”, “fork”, “spork”

Again this would,need a unique name and when the user run it again fitter the lines to display data which just contained those keywords me again highlighted them in red

 

want to try and make it as simple as possible for the users to run these “searches” and whilst they would all have ghere own specific search they would all have access to each others searches also 

Not sure if explained correctly but hopefully someone will know


3 Replies
driver8
Posts (replies): 2070
Admin
(@driver8)
Mod (Amazon Associate)
Joined: 4 years ago

Wow, dUnKle @dunkle ... that's certainly beyond my Excel skills, so I asked AI ...

Maybe this will get you started, or at least give you some google-able keywords ...

ChatGPT:

It sounds like you want to create a filtering system within a large spreadsheet document that allows users to filter data based on specific keywords in certain columns. This can indeed be achieved using macros or scripting, depending on the spreadsheet software you're using.

Here's a general approach using Microsoft Excel as an example:

1. Creating Macros:

In Excel, you can create macros using VBA (Visual Basic for Applications). Macros are essentially recorded sequences of actions that can be replayed later.
You can record a macro that filters data based on specific criteria (keywords) and highlights them in red.

2. Assigning Macros to Buttons:

After creating macros, you can assign them to buttons or shapes in your Excel document.
Users can then click these buttons to execute the macros and perform the filtering actions.

3. Filtering Data:

Use Excel's built-in filtering capabilities to show only rows that match the specified criteria (keywords).
Here's a simplified example of how you might create a macro to filter data based on a specific keyword:

' Clear any existing filters
    ws.AutoFilterMode = False
    
    ' Filter data based on keyword in column J or K
    With ws.Range("J:K")
        .AutoFilter Field:=1, Criteria1:="*" & keyword & "*", Operator:=xlOr, Criteria2:="*" & keyword & "*"
    End With
    
    ' Highlight cells containing the keyword in red
    For Each cell In ws.Range("J:K")
        If InStr(1, cell.Value, keyword, vbTextCompare) > 0 Then
            cell.Font.Color = RGB(255, 0, 0) ' Red color
        End If
    Next cell
End Sub

This macro prompts the user to enter a color keyword, filters data in columns J and K based on that keyword, and highlights cells containing the keyword in red.

You can create similar macros for different search criteria (e.g., CutlerySearch) and assign them to buttons or shapes in your Excel document.

Please note that this is a basic example, and you may need to adapt it to fit your specific requirements and the structure of your data. Additionally, you'll need to handle cases such as multiple users accessing the spreadsheet simultaneously, which might require additional considerations.

Perplexity:

It sounds like you are looking to create custom filtering macros in Excel to allow users to search and filter data based on specific keywords. Here's a step-by-step guide on how you can achieve this:

1. Creating the Macros:

Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
Click on Insert in the menu and then select Module to create a new module.
In the module window, you can write your VBA code for the macros. Here's an example code for the "Colour Search" macro:

Sub ColourSearch()
    Dim cell As Range
    Dim keyword As Variant
    
    For Each cell In Range("J:K")
        For Each keyword In Array("blue", "yellow", "white", "red", "black", "brown")
            If InStr(1, LCase(cell.Value), keyword) > 0 Then
                cell.Interior.Color = RGB(255, 0, 0) ' Highlight in red
                Exit For
            End If
        Next keyword
    Next cell
End Sub

2. Assigning Macro to a Button:

Go back to your Excel sheet.
Click on Developer tab (if not visible, enable it in Excel options).
Click on Insert and then select Button (Form Control).
Draw the button on your sheet and assign the macro (ColourSearch) to it.

3. Running the Macro:

Users can now click on the button to run the "Colour Search" macro and filter data based on the specified keywords.

4. Repeat for Other Searches:

You can create similar macros for other searches like cutlery items by following the same steps with different keywords and highlighting colors.

By following these steps, you can simplify the process for users to run custom searches on your data using macros in Excel. Feel free to customize the code further based on your specific requirements.

👍 

If you've not used AI before, it actually allows you to build on previous answers, so if you add more specific requirements you should be able to get closer to a complete solution.


Reply
Posts (replies): 4
Topic starter
(@dunkle)
New Member
Joined: 3 years ago

Wow.  The ai thing is great, however I think I’m lacking the knowledge to actually as what need correctly or I’m confusing it 

More I try the more I think I’m confusing self and complicating matters and after some thought, looking at data in the columns I think I’d be better “filtering” by rows 

Is this possible, and if so how 

I have my 1000s of rows of data, there are 16 columns 

The data actually starts with the names of each column in row 2

In cell a1 I have a “button” (if this is even possible) 

When the viewer of the data / user of the spreadsheet clicks this button it will filter the rows to only show those rows that have (in any column) any of the primary colours.  

Clicking the button again would then remove the filter ? 


Reply
Posts (replies): 4
Topic starter
(@dunkle)
New Member
Joined: 3 years ago

Didn’t tgink at time to try it but actually just typed that into chatgpt and it seems to have worked. Well it gave me an answer anyway 


Reply