Forum Discussion

Roby7799's avatar
Roby7799
Copper Contributor
Jan 03, 2025

Copy on complex condition

Only for great experts!

I would like to set the following formula, but I don't know if it can be done, can anyone help me?

  • I have two columns M and N. In column M I have approximately twenty numbers lined up (from M1 to M20) associated with the same number in column N (from N1 to N20)
  • In a cell A1 I have a number (let's call it β€œX”)
  • I have to find in column M (cells from M1 to M20) the cell that contains the number equal to "X" and when I have found it I have to copy the contents of the corresponding cell of column N into cell A2. For example, if the value β€œX” was in cell M9, I would have to copy the value of cell N9 into cell A2

I hope I have been clear πŸ˜…

Thanks for the support.

2 Replies

  • In A2, if you have Microsoft 365, Office 2024 or Office 2021:

    =XLOOKUP(A1, M1:M20, N1:N20, "")

    If you have an older version:

    =IFERROR(VLOOKUP(A1, M1:N20, 2, FALSE), "")

    • Roby7799's avatar
      Roby7799
      Copper Contributor

      Thanks, Hans

      the formula is wrong but I didn't know it so you put me on the right track. I found the Italian equivalent and solved it, thanks.

Resources