[Solved] Set value X in column if another column contains Y

Discuss the spreadsheet application
Post Reply
progtesting
Posts: 3
Joined: Wed Aug 31, 2022 1:59 pm

[Solved] Set value X in column if another column contains Y

Post by progtesting »

Hello.

I am new to OpenOffice Calc in general and ofcourse i have stuck an issue i cannot solve easily.


Consider this:

I have multiple rows i have highlighted because these rows contain a specific number.

In this particular case, a set of rims with said dimension that needs to have a certain price.

So i have three highlighted rows and want to insert price into a different column.

If i try to copy/paste the price into multiple and single row the highlighting disappears.

Is this understandable?
I am trying to find a method in which i can insert data into ONE column for multiple highlighted rows.

I am trying my best to explain.

Thanks for any suggestions or pointers.

Prog

 Edit: Changed subject, was Help finding out what i need help with 
Make your post understandable by others 
-- MrProgrammer, forum moderator 
Last edited by MrProgrammer on Wed Sep 07, 2022 7:40 pm, edited 1 time in total.
Apache OpenOffice 4.1.13 on Windows 10
User avatar
keme
Volunteer
Posts: 3704
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: Help finding out what i need help with

Post by keme »

I don't think there is an easy way to paste into only a single cell of a selected row, and leave the rest of the row untouched. You'd need to select the individual target cells.

Logically, unprotecting the target column and protect sheet before row select + paste might work, but it doesn't on my systems.

If selecting single cells is not an option for your workflow, I suspect that some kind of lookup may be useful. If you can upload a sample file with all your content, it is easier to envision viable solutions. Remember that this is a public place, so do not upload any file containing confidential info.
progtesting
Posts: 3
Joined: Wed Aug 31, 2022 1:59 pm

Re: Help finding out what i need help with

Post by progtesting »

For sake of learning.

In the Name-column i want to filter 18
In the Regular Price-column i want to set the price to be 50 for the filtered columns.

I made a smaller version of what i have.
ForzzaLearn.csv
(7.61 KiB) Downloaded 52 times
Apache OpenOffice 4.1.13 on Windows 10
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Help finding out what i need help with

Post by John_Ha »

Never save a spreadsheet as a .csv file as .csv files are awfully simple and crude and do not save much of the spreadsheet information.

See [Tutorial] Differences between Microsoft and AOO/LO files for a description of differences and for why you should always work in, and save Writer files as .odt, Calc files as .ods, Impress files as .odp, etc which says:
.csv files

Spreadsheet .csv files are similar to .txt files in that they are really basic and very crude. This makes them highly portable between systems as they store only text and numbers, and no formatting and sspreadsheet formulae don't work. It is best to think of a .csv file as "a plastic bag used to transport numbers and text from one application (typically a database) to another (typically a spreadsheet) and then promptly thrown away" and not as "a file where a spreadsheet should be stored".
See [Tutorial] Ten concepts that every Calc user should know

See the Calc User Guide. May I suggest you bookmark the page.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
progtesting
Posts: 3
Joined: Wed Aug 31, 2022 1:59 pm

Re: Help finding out what i need help with

Post by progtesting »

Thanks.
I have bookmarked them both.

I will in the future save the files in .CSV as i am using them for WooCommerce-products.
For Woo it does not change the format luckily :)
Apache OpenOffice 4.1.13 on Windows 10
User avatar
MrProgrammer
Moderator
Posts: 4907
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Set value X in column if value Y is in another column

Post by MrProgrammer »

Hi, and welcome to the forum. Thank you for the attachment.
progtesting wrote: Wed Aug 31, 2022 3:06 pm In the Name-column i want to filter 18
In the Regular Price-column i want to set the price to be 50 for the filtered columns.
Learn to use Calc's filter feature.
• Select cell A1 → Data → Define range → Assign a name, say Foo → Add → OK
• Data → Filter → Standard filter → Field Name → Name → Condition → Contains → Value → X18 → OK
• Select cells Z2:Z13 → Type 50 but do not press Enter
• On a Mac, hold Option and press Enter
• On other systems, hold Alt and press Enter
• Data → Filter → Remove Filter
Read section 7. Analyzing and modifying your data in Ten concepts that every Calc user should know.

progtesting wrote: Wed Aug 31, 2022 3:06 pm ForzzaLearn.csv
Almost everyone should ensure that Detect Special Numbers is selected when importing CSV.
[Tutorial] Text to Columns, Q41/A41
As noted earlier in this topic, CSV has many restrictions:
• Cannot save any formatting
• Can save only one sheet
• Cannot save formulas, only values

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.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Post Reply