Multiply cell value in one column if there is a specific

Discuss the spreadsheet application
Post Reply
dontcareiii
Posts: 6
Joined: Sun Jun 23, 2019 1:41 am

Multiply cell value in one column if there is a specific

Post by dontcareiii »

Hey

I am new to Clac

How can I write a function/formula to multiply cell value in one column (J) if there is a specific value (stat_cost) in the same row in A column

Ill guess it be something like
IF A (1-1778 number of rows?) = "stat_cost" then J (in the same row how to point that out?) * 3


Appreciate any help
OpenOffice 3.1 on Windows Vist
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: multiply cell value in one column if there is a specific

Post by Villeroy »

IF is not a solution, particularly when you can not describe the problem in full detail.
So the factor should be 3 if the corresponding text in J happens to be "stat_cost". What if it is not "stat_cost"?
Is there some list of allowed values for column J?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: multiply cell value in one column if there is a specific

Post by Villeroy »

=VLOOKUP( $J2 ; $X$1:$Y$10 ; 2 ; 0 ) * $A2
looks up J2 in X1:X10, returns the corresponding value from column Y and multiplies this looked up value with A2.

X1:Y10 is an arbitrary lookup table which starts like this:
stat_cost 3
... ...

[Tutorial] VLOOKUP questions and answers
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
dontcareiii
Posts: 6
Joined: Sun Jun 23, 2019 1:41 am

Re: multiply cell value in one column if there is a specific

Post by dontcareiii »

It should be

If in a cell in column A value is "stat_cost" then (and only then, if it is not, do nothing with J) multiply value of corresponding J cell in the same row by three

There is a list for values for column A
There is no J as they will be random three digit
OpenOffice 3.1 on Windows Vist
User avatar
robleyd
Moderator
Posts: 5082
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: multiply cell value in one column if there is a specific

Post by robleyd »

dontcareiii wrote:If in a cell in column A value is "stat_cost" then (and only then, if it is not, do nothing with J) multiply value of corresponding J cell in the same row by three
Based on that specification:

Code: Select all

IF(A1="stat_cost"; J1*3; J1)
should do what you want. If for example that formula were in L1 and assuming (at least) A and J have data, then the display in L1 will be either J1 times 3, if A1 = stat_cost or the unchanged data in J1 otherwise. You can then copy the formula into all the places you need it.

If you are new to spreadsheets, you may find the following to be useful resources.

[Tutorial] Ten concepts that every Calc user should know
OpenOffice Spreadsheet Tutorial for Beginners with Examples
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Post Reply