Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An Excel Fromula to generate a UUID v4
=LOWER(CONCATENATE(DEC2HEX(RANDBETWEEN(0;POWER(16;8));8);"-";DEC2HEX(RANDBETWEEN(0;POWER(16;4));4);"-";"4";DEC2HEX(RANDBETWEEN(0;POWER(16;3));3);"-";DEC2HEX(RANDBETWEEN(8;11));DEC2HEX(RANDBETWEEN(0;POWER(16;3));3);"-";DEC2HEX(RANDBETWEEN(0;POWER(16;8));8);DEC2HEX(RANDBETWEEN(0;POWER(16;4));4)))
@BARNZ
Copy link

BARNZ commented Mar 21, 2017

Thanks this is handy! Note, I had to replace the semicolons with commas in my version of excel.

@MobilityMaster
Copy link

MobilityMaster commented Aug 7, 2017

Thank you! Here's the same thing with commas -

=LOWER(CONCATENATE(DEC2HEX(RANDBETWEEN(0,POWER(16,8)),8),"-",DEC2HEX(RANDBETWEEN(0,POWER(16,4)),4),"-","4",DEC2HEX(RANDBETWEEN(0,POWER(16,3)),3),"-",DEC2HEX(RANDBETWEEN(8,11)),DEC2HEX(RANDBETWEEN(0,POWER(16,3)),3),"-",DEC2HEX(RANDBETWEEN(0,POWER(16,8)),8),DEC2HEX(RANDBETWEEN(0,POWER(16,4)),4)))

@cpi-bcso
Copy link

cpi-bcso commented Apr 12, 2018

Just in case I need this again for a german Excel:

=KLEIN(VERKETTEN(DEZINHEX(ZUFALLSBEREICH(0;POTENZ(16;8));8);"-";DEZINHEX(ZUFALLSBEREICH(0;POTENZ(16;4));4);"-";"4";DEZINHEX(ZUFALLSBEREICH(0;POTENZ(16;3));3);"-";DEZINHEX(ZUFALLSBEREICH(8;11));DEZINHEX(ZUFALLSBEREICH(0;POTENZ(16;3));3);"-";DEZINHEX(ZUFALLSBEREICH(0;POTENZ(16;8));8);DEZINHEX(ZUFALLSBEREICH(0;POTENZ(16;4));4)))

@arievandriel
Copy link

arievandriel commented May 9, 2018

The Dutch Excel 2016 version (and in capitals):

=HOOFDLETTERS(TEKST.SAMENV(DEC.N.HEX(ASELECTTUSSEN(0;MACHT(16;8));8);"-";DEC.N.HEX(ASELECTTUSSEN(0;MACHT(16;4));4);"-";"4";DEC.N.HEX(ASELECTTUSSEN(0;MACHT(16;3));3);"-";DEC.N.HEX(ASELECTTUSSEN(8;11));DEC.N.HEX(ASELECTTUSSEN(0;MACHT(16;3));3);"-";DEC.N.HEX(ASELECTTUSSEN(0;MACHT(16;8));8);DEC.N.HEX(ASELECTTUSSEN(0;MACHT(16;4));4)))

@arievandriel
Copy link

arievandriel commented May 9, 2018

Just one question... The GUID's get refreshed evertime I do something to the column or near the column that contain the formula. Is there a way to just generate it once and fix the generated GUID's?

Regards, Arie

@richiethom
Copy link

richiethom commented May 23, 2018

If you just want a list of GUIDs that never change, and are happy pasting them from somewhere else, you could use various websites. The one I use is https://guidgenerator.com/

@thuijssoon
Copy link

thuijssoon commented Aug 7, 2018

@arievandriel, just copy and Paste Special... -> Values

@andrescollao
Copy link

andrescollao commented Sep 6, 2018

The Spanish version for Excel 2018:

=MINUSC(CONCATENAR(DEC.A.HEX(ALEATORIO.ENTRE(0;POTENCIA(16;8));8);"-";DEC.A.HEX(ALEATORIO.ENTRE(0;POTENCIA(16;4));4);"-";"4";DEC.A.HEX(ALEATORIO.ENTRE(0;POTENCIA(16;3));3);"-";DEC.A.HEX(ALEATORIO.ENTRE(8;11));DEC.A.HEX(ALEATORIO.ENTRE(0;POTENCIA(16;3));3);"-";DEC.A.HEX(ALEATORIO.ENTRE(0;POTENCIA(16;8));8);DEC.A.HEX(ALEATORIO.ENTRE(0;POTENCIA(16;4));4)))

Note: Consider your regional configuration, maybe it will be a necessary change from ; to ,

@qacpiweb
Copy link

qacpiweb commented Sep 7, 2018

Polish version with "|"

=LITERY.MAŁE(ZŁĄCZ.TEKSTY(DZIES.NA.SZESN(LOS.ZAKR(0|POTĘGA(16|8))|8)|"-"|DZIES.NA.SZESN(LOS.ZAKR(0|POTĘGA(16|4))|4)|"-"|"4"|DZIES.NA.SZESN(LOS.ZAKR(0|POTĘGA(16|3))|3)|"-"|DZIES.NA.SZESN(LOS.ZAKR(8|11))|DZIES.NA.SZESN(LOS.ZAKR(0|POTĘGA(16|3))|3)|"-"|DZIES.NA.SZESN(LOS.ZAKR(0|POTĘGA(16|8))|8)|DZIES.NA.SZESN(LOS.ZAKR(0|POTĘGA(16|4))|4)))

@leader80
Copy link

leader80 commented Oct 23, 2018

In Italian:

=MINUSC(CONCATENA(DECIMALE.HEX(CASUALE.TRA(0;POTENZA(16;8));8);"-";DECIMALE.HEX(CASUALE.TRA(0;POTENZA(16;4));4);"-";"4";DECIMALE.HEX(CASUALE.TRA(0;POTENZA(16;3));3);"-";DECIMALE.HEX(CASUALE.TRA(8;11));DECIMALE.HEX(CASUALE.TRA(0;POTENZA(16;3));3);"-";DECIMALE.HEX(CASUALE.TRA(0;POTENZA(16;8));8);DECIMALE.HEX(CASUALE.TRA(0;POTENZA(16;4));4)))

@denis-roy
Copy link

denis-roy commented Nov 12, 2018

French one-liner:

=MINUSCULE(CONCATENER(DECHEX(ALEA.ENTRE.BORNES(0;PUISSANCE(16;8));8);"-";DECHEX(ALEA.ENTRE.BORNES(0;PUISSANCE(16;4));4);"-";"4";DECHEX(ALEA.ENTRE.BORNES(0;PUISSANCE(16;3));3);"-";DECHEX(ALEA.ENTRE.BORNES(8;11));DECHEX(ALEA.ENTRE.BORNES(0;PUISSANCE(16;3));3);"-";DECHEX(ALEA.ENTRE.BORNES(0;PUISSANCE(16;8));8);DECHEX(ALEA.ENTRE.BORNES(0;PUISSANCE(16;4));4)))

Indented for readability:

=MINUSCULE(
    CONCATENER(
        DECHEX(ALEA.ENTRE.BORNES(0; PUISSANCE(16; 8)); 8); 
        "-"; 
        DECHEX(ALEA.ENTRE.BORNES(0; PUISSANCE(16;4)); 4); 
        "-"; 
        "4"; 
        DECHEX(ALEA.ENTRE.BORNES(0; PUISSANCE(16; 3)); 3); 
        "-"; 
        DECHEX(ALEA.ENTRE.BORNES(8; 11));
        DECHEX(ALEA.ENTRE.BORNES(0; PUISSANCE(16; 3)); 3); 
        "-"; 
        DECHEX(ALEA.ENTRE.BORNES(0; PUISSANCE(16; 8)); 8); 
        DECHEX(ALEA.ENTRE.BORNES(0; PUISSANCE(16; 4)); 4)
    )
)

Other languages available through this Excel translator website

@oralzb
Copy link

oralzb commented Jan 9, 2019

in Russian
=СТРОЧН(СЦЕПИТЬ(ДЕС.В.ШЕСТН(СЛУЧМЕЖДУ(0;СТЕПЕНЬ(16;8));8);"-";ДЕС.В.ШЕСТН(СЛУЧМЕЖДУ(0;СТЕПЕНЬ(16;4));4);"-";"4";ДЕС.В.ШЕСТН(СЛУЧМЕЖДУ(0;СТЕПЕНЬ(16;3));3);"-";ДЕС.В.ШЕСТН(СЛУЧМЕЖДУ(8;11));ДЕС.В.ШЕСТН(СЛУЧМЕЖДУ(0;СТЕПЕНЬ(16;3));3);"-";ДЕС.В.ШЕСТН(СЛУЧМЕЖДУ(0;СТЕПЕНЬ(16;8));8);ДЕС.В.ШЕСТН(СЛУЧМЕЖДУ(0;СТЕПЕНЬ(16;4));4)))

@chiniara
Copy link

chiniara commented Apr 30, 2019

In Portuguese Brasil
=MINÚSCULA(CONCATENAR(DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;8));8);"-";DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;4));4);"-";"4";DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;3));3);"-";DECAHEX(ALEATÓRIOENTRE(8;11));DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;3));3);"-";DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;8));8);DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;4));4)))

@meszi05
Copy link

meszi05 commented May 22, 2019

In Hungarian:
=KISBETŰ(ÖSSZEFŰZ(DEC.HEX(VÉLETLEN.KÖZÖTT(0;HATVÁNY(16;8));8);"-";DEC.HEX(VÉLETLEN.KÖZÖTT(0;HATVÁNY(16;4));4);"-";"4";DEC.HEX(VÉLETLEN.KÖZÖTT(0;HATVÁNY(16;3));3);"-";DEC.HEX(VÉLETLEN.KÖZÖTT(8;11));DEC.HEX(VÉLETLEN.KÖZÖTT(0;HATVÁNY(16;3));3);"-";DEC.HEX(VÉLETLEN.KÖZÖTT(0;HATVÁNY(16;8));8);DEC.HEX(VÉLETLEN.KÖZÖTT(0;HATVÁNY(16;4));4)))

@mpaulusma
Copy link

mpaulusma commented Oct 30, 2019

I just need to say thank you too! Lifesaver

@mcelal
Copy link

mcelal commented Nov 12, 2019

In Turkish:
=KÜÇÜKHARF(BİRLEŞTİR(DEC2HEX(RASTGELEARADA(0;KUVVET(16;8));8);"-";DEC2HEX(RASTGELEARADA(0;KUVVET(16;4));4);"-";"4";DEC2HEX(RASTGELEARADA(0;KUVVET(16;3));3);"-";DEC2HEX(RASTGELEARADA(8;11));DEC2HEX(RASTGELEARADA(0;KUVVET(16;3));3);"-";DEC2HEX(RASTGELEARADA(0;KUVVET(16;8));8);DEC2HEX(RASTGELEARADA(0;KUVVET(16;4));4)))

@rukayaj
Copy link

rukayaj commented Dec 16, 2019

It generates duplicates for large numbers of UUIDS (14 500 of them) in osx, I ran it 5 or 6 times and there were around 8 duplicates each time.

@MightyMirko
Copy link

MightyMirko commented Feb 21, 2020

Also it is recalculated everytime

@nibble-4bits
Copy link

nibble-4bits commented Apr 28, 2020

Spanish Version:

=MINUSC(CONCAT(DEC.A.HEX(ALEATORIO.ENTRE(0,POTENCIA(16,8)),8),"-",DEC.A.HEX(ALEATORIO.ENTRE(0,POTENCIA(16,4)),4),"-","4",DEC.A.HEX(ALEATORIO.ENTRE(0,POTENCIA(16,3)),3),"-",DEC.A.HEX(ALEATORIO.ENTRE(8,11)),DEC.A.HEX(ALEATORIO.ENTRE(0,POTENCIA(16,3)),3),"-",DEC.A.HEX(ALEATORIO.ENTRE(0,POTENCIA(16,8)),8),DEC.A.HEX(ALEATORIO.ENTRE(0,POTENCIA(16,4)),4)))

@vitalie-cracan
Copy link

vitalie-cracan commented Jul 18, 2020

For within VBA:

Target.Value = _
LCase(WorksheetFunction.Concat( _
WorksheetFunction.Dec2Hex(WorksheetFunction.RandBetween(0, WorksheetFunction.Power(16, 8)), 8), _
"-", _
WorksheetFunction.Dec2Hex(WorksheetFunction.RandBetween(0, WorksheetFunction.Power(16, 4)), 4), _
"-", "4", _
WorksheetFunction.Dec2Hex(WorksheetFunction.RandBetween(0, WorksheetFunction.Power(16, 3)), 3), _
"-", _
WorksheetFunction.Dec2Hex(WorksheetFunction.RandBetween(8, 11)), _
WorksheetFunction.Dec2Hex(WorksheetFunction.RandBetween(0, WorksheetFunction.Power(16, 3)), 3), _
"-", _
WorksheetFunction.Dec2Hex(WorksheetFunction.RandBetween(0, WorksheetFunction.Power(16, 8)), 8), _
WorksheetFunction.Dec2Hex(WorksheetFunction.RandBetween(0, WorksheetFunction.Power(16, 4)), 4) _
))

@4cer
Copy link

4cer commented Aug 23, 2021

Polish version with ";"
=LITERY.MAŁE(ZŁĄCZ.TEKSTY(DZIES.NA.SZESN(LOS.ZAKR(0;POTĘGA(16;8));8);"-";DZIES.NA.SZESN(LOS.ZAKR(0;POTĘGA(16;4));4);"-";"4";DZIES.NA.SZESN(LOS.ZAKR(0;POTĘGA(16;3));3);"-";DZIES.NA.SZESN(LOS.ZAKR(8;11));DZIES.NA.SZESN(LOS.ZAKR(0;POTĘGA(16;3));3);"-";DZIES.NA.SZESN(LOS.ZAKR(0;POTĘGA(16;8));8);DZIES.NA.SZESN(LOS.ZAKR(0;POTĘGA(16;4));4)))

@jgalinha
Copy link

jgalinha commented Dec 20, 2021

in Portuguese:
=MINÚSCULAS(CONCATENAR(DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;8));8);"-";DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;4));4);"-";"4";DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;3));3);"-";DECAHEX(ALEATÓRIOENTRE(8;11));DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;3));3);"-";DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;8));8);DECAHEX(ALEATÓRIOENTRE(0;POTÊNCIA(16;4));4)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment