![]() |
Swap Two Values in one Command
How to swap Two Values in one Command.
xxx=value1 value1=value2 value2=xxx |
Swap Two Values in one Command
I think you'll need that intermediate variable.
sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson |
Swap Two Values in one Command
If Value1 and Value2 are numeric values, then you can swap them without the
need for an intermediate variable... Value1 = Value1 + Value2 Value2 = Value1 - Value2 Value1 = Value1 - Value2 -- Rick (MVP - Excel) "Dave Peterson" wrote in message ... I think you'll need that intermediate variable. sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson |
Swap Two Values in one Command
Interesting way of doing the swap and had a look at it, but using an
intermediate variable turns out to be twice as fast. RBS "Rick Rothstein" wrote in message ... If Value1 and Value2 are numeric values, then you can swap them without the need for an intermediate variable... Value1 = Value1 + Value2 Value2 = Value1 - Value2 Value1 = Value1 - Value2 -- Rick (MVP - Excel) "Dave Peterson" wrote in message ... I think you'll need that intermediate variable. sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson |
Swap Two Values in one Command
Hello Mr. Rothstein,
Very nice solution. I usually enjoy your replies and wonder which forum you are going to "migrate" to? I am a bit disappointed in MS's phony instructions. Best Regards, Gabor Sebo ----- Original Message ----- From: "Rick Rothstein" Newsgroups: microsoft.public.excel.programming Sent: Sunday, May 30, 2010 12:21 AM Subject: Swap Two Values in one Command If Value1 and Value2 are numeric values, then you can swap them without the need for an intermediate variable... Value1 = Value1 + Value2 Value2 = Value1 - Value2 Value1 = Value1 - Value2 -- Rick (MVP - Excel) "Dave Peterson" wrote in message ... I think you'll need that intermediate variable. sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson "Rick Rothstein" wrote in message ... If Value1 and Value2 are numeric values, then you can swap them without the need for an intermediate variable... Value1 = Value1 + Value2 Value2 = Value1 - Value2 Value1 = Value1 - Value2 -- Rick (MVP - Excel) "Dave Peterson" wrote in message ... I think you'll need that intermediate variable. sort wrote: How to swap Two Values in one Command. xxx=value1 value1=value2 value2=xxx -- Dave Peterson |
All times are GMT +1. The time now is 05:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com