Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I need to select randomly between two strings, say "A" and "B".

I do =CHOOSE(RANDBETWEEN(1,2), "one", "two")

It doesn't work.

Neither =CHOOSE(1, "one", "two")

It shows ERROR.

share|improve this question
1  
Have you tried a semicolon in stead of a comma? –  Jacob Jan Tuinstra Aug 30 at 8:27
    
It should work, see: webapps.stackexchange.com/a/44719/29140 –  Jacob Jan Tuinstra Aug 30 at 8:28

2 Answers 2

up vote 1 down vote accepted

Both formula's work as intended, see screenshot.

Screenshot

enter image description here

Note

As mentioned in my comment, the CHOOSE formula is present in Excel and Google Sheets. You need to use a semicolon in stead of a comma.

Example

I've created an example file for you: CHOOSE

Reference

share|improve this answer
1  
Thanks. It worked using ; everywhere. –  redraw Aug 31 at 2:32

The syntax and effect of CHOOSE is exactly the same for Google Spreadsheets as for Excel. However, I suspect your locale for the sheet in which your formulae are not working has been set to Spain. In that case (and indeed for certain other locales) the required delimiter for the parameters is ; rather than ,. Hence I believe @Jacob Jan Tuinstra’s solution should work for you in the sheet where you were experiencing errors.

However, you might want to consider an alternative solution if regularly switching between Excel with , and Google Spreadsheets with ; or because you are more familiar with the comma version but are temporarily working with a spreadsheet created by someone applying the semicolon version.

To change the locale for a spreadsheet to one, say USA, where Google Spreadsheets requires , click on File, Spreadsheet settings…, click the top box and select country or country/language of your choice. Valid formulae already existing in a sheet whose locale is changed should automatically acquire the revised delimiter.

share|improve this answer
    
Thanks for help. However, it didn't work using ;. Also, it shows and error when trying changing the locale setting. I select USA and it returns "File not available ..refresh" –  redraw Aug 31 at 2:28
    
oh, solved. I had to also change comma to semicolon inside RANDBETWEEN() function, not just CHOOSE one. It doesn't let me change locale setting although. –  redraw Aug 31 at 2:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.