[Solved] Err:501 Counting occurrences of character in cell

Discuss the spreadsheet application
Locked
User avatar
morphingstar
Posts: 108
Joined: Mon Mar 28, 2011 5:52 am
Location: Mx

[Solved] Err:501 Counting occurrences of character in cell

Post by morphingstar »

 Edit: Split from [Solved] Counting occurrence of specific character in cell because that topic is solved thus morphingstar
needs their own topic 
Tks Mr P., whatever I do I get error, usually 501 in Libre Office. I use OO Calc mainly for the HELP section, easier than LO.
LEN(cell)-LEN(SUBSTITUTE(cell;"-";"")) x LEN($d$101)-LEN(SUBSTITUTE(cell;”\”;"")) x =LEN(($D$101)-LEN(SUBSTITUTE($D$101,”\”;""))))) surplus brackets added by LO.
I need to count "\" in path of file list
Examples, 1 source cell contains file name, extension, path. The goal is to separate the items into specific columns [FN¦Ext¦Path]
1of 99.jpg jpg C:\Users\ALL\Pictures\_PRINTSCREEN\
danwinter 2h12m46_humLion.jpg jpg C:\Users\ALL\Pictures\_PRINTSCREEN\ancient\
toulouse_peg01.jpg jpg C:\Users\ALL\Pictures\_PRINTSCREEN\ancient\PEG\
There can be more "\", the number varies, = minimum of selected folder, in this case _PRINTSCREEN includes minimum 5 x \.

I pasted the formula from URL into sheet. Entering formulas with keyboard often fails to work in LO. Err501 is unavoidable.
I opened the sheet with OO, the same error appears.

Cell I97 shows the error.
Hoping for a solution. Thanks.
Attachments
db_design_for_files_folders_path.ods
error 501 for slash count cell i97
(9.45 KiB) Downloaded 250 times
Last edited by MrProgrammer on Sat Feb 19, 2022 11:37 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] since error was caused by using ” instead of " -- MrProgrammer, forum moderator
OO 4.1.6 on Win10. Member since StarOffice 7. Alternative name "morphingstar2" when other fails. Use Writer, Calc (as DB + Calc), Draw. Impress mainly for Eyedropper and animating GIFs. Updated 20190716.
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: [Solved] Counting occurrence of specific character in ce

Post by RusselB »

The SUBSTITUTE function in I97 is missing parameters.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
Zizi64
Volunteer
Posts: 11506
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Err:501 Counting occurrences of character in cell

Post by Zizi64 »

Code: Select all

=LEN($D$101)-LEN(SUBSTITUTE($D$101;"\";""))
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11506
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Err:501 Counting occurrences of character in cell

Post by Zizi64 »

Otherwise the extension PYSTRING has a function named COUNT(). That counts the occurrence of the specific character (or substring) in the passed string:

viewtopic.php?t=83856&p=426777
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
morphingstar
Posts: 108
Joined: Mon Mar 28, 2011 5:52 am
Location: Mx

Re: Err:501 Counting occurrences of character in cell

Post by morphingstar »

RusselB _ Reason given: Missing parameters. Action: Reduced formula to =SUBSTITUTE("0rgonlab.jpg jpg C:\Users\ALL\Pictures\_PRINTSCREEN\",”\”,"§"). Enter] results in added ")", error501 remains. 3 Parameters: Text to check, character to replace, character replacement. My formula included 3 parameters: Cell, character to replace, character replacement = none, not even space! I wonder what is missing.

Hubert Lambert _ Thanks, if I can not get OO LO formula to work as promised I shall try the Pyton oxt.
I would prefer a correct working formula. Will check with LO Forum. Will let you know the reason of failure.

Thank you both.
OO 4.1.6 on Win10. Member since StarOffice 7. Alternative name "morphingstar2" when other fails. Use Writer, Calc (as DB + Calc), Draw. Impress mainly for Eyedropper and animating GIFs. Updated 20190716.
User avatar
RusselB
Moderator
Posts: 6646
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Err:501 Counting occurrences of character in cell

Post by RusselB »

Not sure why, but trying your formula manually entered as you posted it gives me the same results, however, by putting the text for the first parameter into a cell and then referencing that cell as the first parameter, the formula works fine.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
MrProgrammer
Moderator
Posts: 5435
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Err:501 Counting occurrences of character in cell

Post by MrProgrammer »

morphingstar wrote:Reduced formula to =SUBSTITUTE("0rgonlab.jpg jpg C:\Users\ALL\Pictures\_PRINTSCREEN\",”\”,"§") … error501 remains
You must use an actual quotation mark in formulas, not the bogus Right Double Quotation Mark.
Bogus Quotes.png
[Tutorial] Calc formula terms

Also, if you are using OpenOffice 4.1.6, as claimed by your signature, you must use semicolon as the operand separator, not comma. Fix your forum signature, if needed, in User Control Panel → Profile → Edit Signature or you risk receiving inappropriate advice for your situation.
Bogus Signature.png
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.

[Tutorial] Ten concepts that every Calc user should know
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).
User avatar
robleyd
Moderator
Posts: 5509
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Err:501 Counting occurrences of character in cell

Post by robleyd »

Crossposted on the AskLO forum.

If you cross post, please let us know that you have done so, otherwise it leads to several discussions and a waste of time because several identical answers may be posted by different users.
Slackware 15 (current) 64 bit
Apache OpenOffice 4.1.16
LibreOffice 26.2.3.2; SlackBuild for 26.2.3 by Eric Hameleers
---------------
I hate this damn computer, I wish that I could sell it.
It won't do what I want it to, Only what I tell it.
Locked