Hello all,
Can anyone help me write a function for a randomly generated marital status (M,S)?
Thanks....
Hello all,
Can anyone help me write a function for a randomly generated marital status (M,S)?
Thanks....
For Excel 2007 and higher:
The same formula can be used in Excel 2003 and lower, but you'll have to enable the Analysis Toolpak Addin![]()
Please Login or Register to view this content.
Hope that helps,
~tigeravatar
Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble
try :
=If(Randbetween(1,2)=1,"M","S")
Hopethis helps![]()
A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
-Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
-To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
If you received helpful response, please remember to hit the * of that post
If you don't want to use RANDBETWEEN(), which is why the Analysis Toolpak is necessary, you can use this instead:
![]()
Please Login or Register to view this content.
This isn't something that needs to be done through VBA. You can place the formula below in whichever cell(s) that you want the randomly generated marital status. However, once you have them placed in all the cells that you want, I would copy all the cells and paste special values to remove the formula because it will constantly change between S and M as someone edits any cell in the file.
Edit:![]()
Please Login or Register to view this content.
Sorry for essentially posting the same code. I thought my page refreshed to see if there were any posts but I guess it didn't.
Another way..
=CHOOSE(INT(RAND()*2)+1,"M","S")
Life's a spreadsheet, Excel!
Say thanks, Click *
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks