Ask Your Question
0

How can I set a variable with text?

asked 2016-02-16 06:51:52 +0200

BillyNotReally gravatar image

Basically, I want to set a variable. When a cell has text in it ("Yes" or "No" in this case), I want to set a variable for that row (2 for "Yes", 0 for "No").

Edit: I had a second problem here but I managed to fix it.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-02-17 10:24:19 +0200

pierre-yves samyn gravatar image

Hi

It is not easy to answer this question because you do not give the context of use of this variable: in a table cell, in a formula, a program (eg basic), etc.

You do not indicated your experience of a spreadsheet. I could therefore respond by what may seem to you the obvious. Sorry if this is the case.

If the cell containing the text is A1 you can, for example in B1 enter a formula: =IF(A1="Yes";2;0)

Please note, this formula will return 2 only if A1 contains "Yes". "yes" will return 0, as well as cells containing "No" or any text and empty cells.

You can treat this case with a more complete formula: =IF(A1="Yes";2;IF(A1="No";0;""))

It is also possible to create named formulas (menu InsertNames) but it is a little more complex.

If you are beginner in the use of Calc I suggest you consult the documentation available here.

Regards

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-16 06:28:55 +0200

Seen: 221 times

Last updated: Feb 17 '16