[Solved] Search for multiple values

Discuss the spreadsheet application
Locked
RussvA
Posts: 5
Joined: Sat Nov 25, 2023 4:50 pm

[Solved] Search for multiple values

Post by RussvA »

Hi all
I am stuck and hoping for guidance. I have very limited knowledge of coding, formulas and macro's.
I have a spreadsheet (attached) which contains all the Preset Rife treatment programs loaded into my hardware. On this sheet is a column named 'Treatment Frequencies', and each cell has the list of frequencies covered in that preset program.

What I am trying to do, is use the 'Find' function to show me the cells that have 1 or more of a list of frequencies that I punch in. e.g. I wish to find cells that have frequencies 1550, 2720, 776, 5000 in it. I will then select the appropriate 'Program Name' from the spreadsheet and cut and paste to my report.

Is there a way to do this?
Many thanks
Russ

 Edit: Changed subject, was Complex finding 
Make your post understandable by others 
-- MrProgrammer, forum moderator 
Attachments
MASTER Preset programmes on WavePro 6 - Spreadsheet.ods
(51.84 KiB) Downloaded 96 times
Last edited by RussvA on Fri Aug 15, 2025 1:54 pm, edited 1 time in total.
OpenOffice 4.1.14 AOO4114m1(Build:9811) - Rev. a0d24fb625 2023-02-08 19:47
Windows11 Pro 64bit
FJCC
Moderator
Posts: 9615
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Complex finding

Post by FJCC »

I think I'm not really understanding what you need. You can search for cells that have one or more of the given frequencies by putting

Code: Select all

1550|2720|776|5000
in the Search For box of the Find & Replace dialog, clicking More Options, selecting Regular Expressions, and clicking Find All. That will select many cells. How do you choose among those cells?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
MrProgrammer
Moderator
Posts: 5421
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Complex finding

Post by MrProgrammer »

RussvA wrote: Fri Aug 08, 2025 2:52 pm I have very limited knowledge …
[Tutorial] Ten concepts that every Calc user should know

RussvA wrote: Fri Aug 08, 2025 2:52 pm … use the 'Find' function …
FIND() is a Calc function. Find is also a Calc feature: Edit → Find & Replace. Both of them might help you with this task. Your post does not make it clear to me which one you mean. I know you said function, but people often confuse these terms, and I've found it's better to ask for clarification.

RussvA wrote: Fri Aug 08, 2025 2:52 pm 1 or more of … frequencies 1550, 2720, 776, 5000 in it …
All of them? At least one of them? Your post does not make your meaning clear.

RussvA wrote: Fri Aug 08, 2025 2:52 pm … use the 'Find' function …
Explain the goal, not the step. There may be an easier path than the one you chose.
XY Problem

RussvA wrote: Fri Aug 08, 2025 2:52 pm … each cell has the list of frequencies …
Storing more than one piece of information per cell always complicates using Calc. However you can use the Regular Expressions feature to search for substrings in a cell. For example,  .*\b776\b.*  will match cells which contain 776.

RussvA wrote: Fri Aug 08, 2025 2:52 pm I will then select the appropriate 'Program Name' from the spreadsheet and cut and paste to my report.
You could use Data → Filter → Advanced Filter. This will display only the desired rows. Use Edit → Copy and not Edit → Cut! Then you can paste all the program names in one step. Read about Advanced Filter in Help → Index or in User Guides (PDF) or searching for topics about it in the Calc Forum. You could also use Standard Filter. Always use Data → Define Name to give your range a name before using a filter. Given the data layout in your attachment do not include column A or row 1 in the range.
Rows filtered by Advanced Filter feature
Rows filtered by Advanced Filter feature
202508080904.gif (91.02 KiB) Viewed 2933 times

If this solved your problem please go to your first post use the Edit ✏️ button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
RussvA
Posts: 5
Joined: Sat Nov 25, 2023 4:50 pm

Re: Complex finding

Post by RussvA »

Thanks guys. Greatly appreciated.
Sorry for my poor description of what I needed.
I will try and clarify my need.
So I have the preset Rife programmes spreadsheet as above. Now all I actually want to do, is select a Calc function that I can put a selection of frequencies into, either with a , or a | between them, and then get Calc to display the respective lines from the above spreadsheet, that have most or all of these frequencies.
Not sure if this is possible.
hope this is clearer.
Thanks
Russ
OpenOffice 4.1.14 AOO4114m1(Build:9811) - Rev. a0d24fb625 2023-02-08 19:47
Windows11 Pro 64bit
FJCC
Moderator
Posts: 9615
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Complex finding

Post by FJCC »

Here is one solution that might be acceptable if you don't have to search for many frequencies. I added columns to look for each frequency and return a 1 if its in column D. The Total column adds the counts and has a filter on it, so you can view all the rows that have the highest count. You can change the numbers in row three to adjust the search and you can insert more columns if you need to search for more than four values. You can leave the cells in row 3 blank if you need to search for fewer than four values.
For the formulas to work, go to Tools -> Options -> OpenOffice Calc -> Calculate and turn on Regular Expressions and turn off the open to match whole cells.
Attachments
MASTER Preset programmes on WavePro 6 - Spreadsheet_FJCC.ods
(80.3 KiB) Downloaded 71 times
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Alex1
Volunteer
Posts: 851
Joined: Fri Feb 26, 2010 1:00 pm
Location: Netherlands, EU

Re: Complex finding

Post by Alex1 »

FJCC wrote: Sat Aug 09, 2025 3:37 pmFor the formulas to work, go to Tools -> Options -> OpenOffice Calc -> Calculate and turn on Regular Expressions and turn off the open to match whole cells.
These settings are stored in the file.
AOO 4.1.16 & LO 25.8.3 on Windows 10
RussvA
Posts: 5
Joined: Sat Nov 25, 2023 4:50 pm

Re: Complex finding

Post by RussvA »

Thanks MrProgrammer.
So I tried to use Advanced filter step by step in Calc 'Help" but keep getting a error. It all falls apart when the instruction... "Enter the filter conditions linked with OR in rows 21, 22, and so on...." but there is no hint as to where to enter these conditions. "Range does not contain a valid query"
OpenOffice 4.1.14 AOO4114m1(Build:9811) - Rev. a0d24fb625 2023-02-08 19:47
Windows11 Pro 64bit
User avatar
Lupp
Volunteer
Posts: 3755
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Search for multiple values

Post by Lupp »

This seems to be one of the cases where a shift to LibreOffice should be considered.
There are the function REGEX() since V 6.2 and the array function FILTER() since V 24.8 which are useful in the context.
Of course FILTER() has also the disadvantages of all the array functions locking an output range.
For visitors who want to test a solution needing a recent LibO, I attach a reworked example:
aoo113003exampleNeedingLibO24_8_OrHigher.ods
(82.19 KiB) Downloaded 62 times
The above "solution" has flaws. Since nobody was interested in it I don't upload the fixed version.
Now there was a download. I therefore attach the "fixed" suggestion.
aoo113003exampleNeedingLibO24_8_OrHigherBsmall.ods
(83.89 KiB) Downloaded 61 times
I had to cut off rows to reduce the file size.

As always I'm interested in criticism.
The original example contains rows where I don't understand the "information" under "Treatment Frequencies"
See row 46 e.g. What shall the the "filter formula" return for a lookup value of 10 if such a cell contains "1111 for 10 min" but no "10" in the position of an actual frequency?
The solution by @FJCC regarding the remark by @Alex1 would return a match.
Postulate: Compounds are not really qualified as data.
Last edited by Lupp on Fri Aug 15, 2025 3:25 pm, edited 6 times in total.
On Windows 10: LibreOffice 25.8.4 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
MrProgrammer
Moderator
Posts: 5421
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Search for multiple values

Post by MrProgrammer »

RussvA wrote: Thu Aug 14, 2025 10:13 am there is no hint as to where to enter these conditions
You enter the conditions as described on the help page where it says: Choose Data - Filter - Advanced Filter, and then select the range A20:E22. It also shows the entries in those cells. When you're having trouble with a feature, always start by replicating the example that was provided to see it in operation. Then you have a working example to do further experimentation with.

I've attached an example of Advanced Filter on your data. I put the attachment's filter criteria in B1:D2. I have them in a row instead of a column because I wanted to use AND instead of OR. You can do it either way, row or column, depending on what you need to find. Because you've stored multiple frequencies in one cell, you need to use the \b feature and enable More → Regular Expressions in Advanced Filter. If you don't use \b, a search for 776 would find 2776.
202508140856.ods
(62.6 KiB) Downloaded 68 times

Although you could use Advanced Filter, given your data layout I think FJCC's filter method will work better for you.

If this solved your problem please go to your first post use the Edit ✏️ button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
RussvA
Posts: 5
Joined: Sat Nov 25, 2023 4:50 pm

Re: Search for multiple values

Post by RussvA »

Thanks Alex1
OpenOffice 4.1.14 AOO4114m1(Build:9811) - Rev. a0d24fb625 2023-02-08 19:47
Windows11 Pro 64bit
Locked