Page 1 of 1

[Solved] How to trigger a formula using text

PostPosted: Sat May 09, 2020 5:14 pm
by Tinear
I am very new to spreadsheets and not much of a computer person.

I have a column that is either 'yes' or 'no'.

Depending on which condition there is two different formulas.

So very roughly:

D3 is either 'yes' or 'no'

If 'yes' then F3 = C3/B3
If ' no' then G3 = G3 + C3
All help greatly appreciated.

Re: How to trigger a formula using text

PostPosted: Sat May 09, 2020 6:24 pm
by FJCC
In F3 you can use the formula
Code: Select all   Expand viewCollapse view
=IF(D3 = "yes";C3/B3;"")

You cannot have a cell containing a reference to itself. Do you really mean for G3 to contain
Code: Select all   Expand viewCollapse view
G3 + C3

What are you trying to accomplish?

Re: How to trigger a formula using text

PostPosted: Sat May 09, 2020 8:16 pm
by Tinear
Thanks for replying.

So looking at this again, there are two things that matter:

Is D3 "yes" or "no" and what happens with the value in C3.
As to G3 I could create another column deal with it,

So this would become:
If D3 = "no" then H3=G3+C3


I sort of had something similar to your IF formula, but I admit to being a bit lost with all the quotation marks.

=IF(D3 = "yes";C3/B3;"")


Effectively at the heart of the matter is, can you have two formulas in the same cell (D3) and use only one of them based on the text condition (yes or no) of that cell?

Pardon if I'm a bit scattered here. I have not had to think this way in several decades.

Re: How to trigger a formula using text

PostPosted: Sat May 09, 2020 9:24 pm
by Zizi64
Code: Select all   Expand viewCollapse view
=IF(D3 = "yes";C3/B3;"")


The "yes" is a string of the condition. The "" is an empty string. This will be the result when the condition is false. You can replace it with an another result.

How to use the IF:
=IF(Condition ; Result for the True ; Result for the False)

Re: How to trigger a formula using text

PostPosted: Sat May 09, 2020 9:43 pm
by Tinear
Thank You for the reply.

Not sure I have grasped this entirely, but can I do:

D3 =IF(D3 = "yes";C3/B3; "no";H3 = G3+C3)

Re: How to trigger a formula using text

PostPosted: Sat May 09, 2020 9:54 pm
by FJCC
If the only possible entries in D3 are yes and no, you can use
Code: Select all   Expand viewCollapse view
D3 =IF(D3 = "yes";C3/B3; G3+C3)

That means that if D3 contains yes, the cell will display C3/B3 otherwise it will display G3 + C3

Re: How to trigger a formula using text

PostPosted: Sat May 09, 2020 10:16 pm
by Tinear
Thanks for your reply.

And I got slightly off track a bit.
Ok, well I'm learning a little here and still not quite where I wish to be.

I think I may not be expressing my desire correctly.

What I am trying to do is have D3 = "yes" cause the formula F3 = C3/B3 to display in F3
and when D3 = "no" cause the formula H3 = G3 + C3 to display in H3

Re: How to trigger a formula using text

PostPosted: Sat May 09, 2020 10:37 pm
by RusselB
In F3 enter the formula
Code: Select all   Expand viewCollapse view
if(D3="yes";C3/B3;"")

In H3 enter the formula
Code: Select all   Expand viewCollapse view
if(D3="no";G3+H3;"")

Please note that if you enter something other than yes or no in D3, then both F3 and H3 will appear empty.

Re: How to trigger a formula using text

PostPosted: Sun May 10, 2020 2:43 am
by Tinear
Thank you for your reply.

Think I learned a little something else with this answer, regarding how to look at the problem and from my own field, which can involve a lot of troubleshooting, this is huge part of the issue. Also learning some new, for me, lingo.

I won't have chance to try this out tonight, but all being well sometime tomorrow.

All greatly appreciated.

Stay Safe

Re: How to trigger a formula using text

PostPosted: Sun May 10, 2020 9:55 pm
by Tinear
:bravo:

Thanks to all whom answered. I have learned a few things and ultimately this is what you want. This situation has been resolved.