How can I generate GUIDs in Excel?

前端 未结 11 1033
别那么骄傲
别那么骄傲 2020-11-27 14:58

I have an excel file with one order on each row, and I want each order to have a unique identifier, so there will be a Unique ID column. Every time I fill a row, I want Exce

11条回答
  •  被撕碎了的回忆
    2020-11-27 15:41

    The following Excel expression evaluates to a V4 GUID:

    =CONCATENATE(DEC2HEX(RANDBETWEEN(0,4294967295),8),"-",DEC2HEX(RANDBETWEEN(0,6553‌​5),4),"-",DEC2HEX(RANDBETWEEN(16384,20479),4),"-",DEC2HEX(RANDBETWEEN(32768,49151‌​),4),"-",DEC2HEX(RANDBETWEEN(0,65535),4),DEC2HEX(RANDBETWEEN(0,4294967295),8))

    -or (depending on locale setting/decimal and list separators)-

    =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))

    Note that the first character of the third group is always 4 to signify a V4 (pseudo-random number generated) GUID/UUID per RFC 4122 section 4.4.

    Also note that the first character of the fourth group is always between 8 and B per the same RFC.

    Standard disclaimer: the resulting GUIDs/UUIDs are not cryptographically strong.

提交回复
热议问题