Hvordan XOPSLAG anvendes

Hans-Jørgen Stahl 20 Omdømmepoint
2026-05-05T10:19:08.29+00:00

How to create an Excel formula that takes values ​​from column H in SHEET1 and compares them with column F in SHEET2 and writes the value from column D in SHEET2 to column G in SHEET1

Microsoft Teams | Microsoft Teams til uddannelse | Indsigt
0 kommentarer Ingen kommentarer

Svar accepteret af spørgsmålets forfatter
Tamara-Hu 17,960 Omdømmepoint Eksternt Microsoft-personale Redaktør
2026-05-05T10:51:17.9466667+00:00

Since you description is in English , I’ll reply in this language as well. If you’re more comfortable using another language, please let me know, I’ll be happy to tailor my response to your preferred language. 

Hi @Hans-Jørgen Stahl,

You can do this with a lookup formula in Excel. 

In SHEET1, column G, enter the following formula (starting in G2): 

  • In English:
=XLOOKUP(H2, SHEET2!F:F, SHEET2!D:D, "")  
  • In Danish:
=XOPSLAG(H2; SHEET2!F:F; SHEET2!D:D; "")

This looks at the value in column H on SHEET1, finds the same value in column F on SHEET2, and returns the corresponding value from column D on SHEET2. If no match is found, it will leave the cell blank. 

After entering the formula, drag it down to apply it to the rest of the column. 

For your reference: XLOOKUP function - Microsoft Support

If you’re not using Excel 365 or Excel 2021, this version works in older Excel: 

  • In English:
=IFERROR(INDEX(SHEET2!D:D, MATCH(H2, SHEET2!F:F, 0)), "")  
  • In Danish:
=HVIS.FEJL(INDEKS(SHEET2!D:D; SAMMENLIGN(H2; SHEET2!F:F; 0)); "")

Please let me know if you want it limited to specific ranges or need it to handle multiple matches differently. 

Kind Regards,


If the answer is helpful, please click "Accepter Svar" and kindly upvote it. If you have extra questions about this answer, please click "Kommentér". 

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Var dette svar nyttigt?

2 personer fandt dette svar nyttigt.

0 ekstra svar

Sortér efter: Meget nyttig

Dit svar

Svar kan markeres som "Accepteret" af spørgsmålsforfatteren og "Anbefalet" af redaktører, hvilket hjælper brugerne med at vide, at svaret løste forfatterens problem.