Swapping cell values

  • Hi Jon,
    A function can only affect the cell it's in. Any swap has to store one of the values somewhere temporarily. Excel hides this when you swap adjacent cells (or columns) with the cut and insert method. Othertimes, as in a macro, one set of values needs temporary storage so it's not lost when the other set is written over it. Do you have a specific situation in mind?

  • What I meant to ask was, is there a SWAP function?

    lets say we have data in A and B
    to swap data, i need to:
    - Copy A to a temp
    - Copy B to A
    - Copy Temp to B
    - Destroy Temp

    I was just wondering if there was a pre-made function available. Although while waiting for my answer, I actually wrote my own, so its all good :)

  • Hi,

    If you are still wondering about not using a "temp" location, forget it. Logically, if you break down the process either in excel or as deep as what happens in the processor itself, it is impossible.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!