I need a function to add a GUID to cells in excel. I found this previous question on stackoverflow, but it is not working. It suggests the following function:
=CONCATENATE(DEC2HEX(RANDBETWEEN(0,4294967295),8),"-",DEC2HEX(RANDBETWEEN(0,65535),4),"-"
,DEC2HEX(RANDBETWEEN(16384,20479),4),"-",DEC2HEX(RANDBETWEEN(32768,49151),4),"-"
,DEC2HEX(RANDBETWEEN(0,65535),4),DEC2HEX(RANDBETWEEN(0,4294967295),8))
I have been unable to get the concatenate method to work, and so tried it using the "&" figure to concatenate anyway. That seemed to work, but then I get an inexplicable error on the second DEX2HEX
block: DEC2HEX(RANDBETWEEN(0,65535),4)
. The Excel formula evaluator says it's invalid, but I can't seem to figure out why at all. Any ideas?
RANDBETWEEN
was only introduced in 2007. If you use 2003, replace it withINT(RAND()*65535)
– Crumblybut then I get an inexplicable error on the second DEX2HEX block
- assuming that 1st block is ok) – DisinheritRANDBETWEEN
works fine. – Disinherit