ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   number replacement (https://www.excelbanter.com/excel-discussion-misc-queries/127300-number-replacement.html)

Huseyin

number replacement
 
Hello,
I have two column of numbers, all the numbers in column A must be smaller
than the ones column B. For example, 170 in the 5th row, column B must be
switched with 200 in column A. Row 6 and the last row have the same problem.
Is there an easy way of doing this? Thanks.
A B
160 170
160 170
160 180
200 170
160 180
200 180


CLR

number replacement
 
You could use helper columns, C and D with Min(a1:b1) and Max(A1:B1) formulas
therein and copied down.....then Copy PasteSpecial Values on both of
those columns to get rid of the formulas and then delete columns A and
B.......or, if this is something you must do frequently, one could write a
macro to do it..........

Vaya con Dios,
Chuck, CABGx3



"Huseyin" wrote:

Hello,
I have two column of numbers, all the numbers in column A must be smaller
than the ones column B. For example, 170 in the 5th row, column B must be
switched with 200 in column A. Row 6 and the last row have the same problem.
Is there an easy way of doing this? Thanks.
A B
160 170
160 170
160 180
200 170
160 180
200 180


Bernard Liengme

number replacement
 
This could be done with VBA but if it is a one-off situation here is a
process that works.
1 If needed insert 2 new columns after B ( they will be remove at the end)
2 In the new C1 enter =MIN(A1:B1); in the new D1 enter =MAX(A1:B1)
3 Copy these down the column (select C1 and D1 and double click D1's fill
handle - the small solid square in lower right corner). I will assume the
last cell is D100.
3 If necessary, select C1:D100 and use the Copy tool.
4 With the range C1:D100 still selected use the menu command Edit | Paste
Special and specify Values in the dialog box
5 The range C1:D1 now has what you want so you can delete columns A and B
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Huseyin" wrote in message
...
Hello,
I have two column of numbers, all the numbers in column A must be smaller
than the ones column B. For example, 170 in the 5th row, column B must be
switched with 200 in column A. Row 6 and the last row have the same
problem.
Is there an easy way of doing this? Thanks.
A B
160 170
160 170
160 180
200 170
160 180
200 180





All times are GMT +1. The time now is 07:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com