![]() |
Copy value
If B4 contains the same number as A3, how can I put the number in A4?
Here is my spreadsheet: A B 1 0082766 2 0082767 3 0082768 0082768 4 0082768 5 0082768 6 0082768 7 0082768 8 0104361 9 0104365 10 0104367 11 0104368 12 0104370 13 0104409 0104409 14 0104409 ========= This is the result I'm looking for: A B 1 0082766 2 0082767 3 0082768 0082768 4 0082768 0082768 5 0082768 0082768 6 0082768 0082768 7 0082768 0082768 8 0104361 9 0104365 10 0104367 11 0104368 12 0104370 13 0104409 0104409 14 0104409 0104409 |
Copy value
=IF(A3=B4,A3,"")
-- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
Copy value
On Nov 7, 1:08*pm, gary wrote:
If B4 contains the same number as A3, how can I put the number in A4? Here is my spreadsheet: * * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * * * * * * * * * * 0082768 * 5 * * * * * * * * * * 0082768 * 6 * * * * * * * * * * 0082768 * 7 * * * * * * * * * * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * * * * * * * * * * 0104409 ========= This is the result I'm looking for: * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * *0082768 * 0082768 * 5 * *0082768 * 0082768 * 6 * *0082768 * 0082768 * 7 * *0082768 * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * 0104409 * *0104409 You posted in misc and I gave you a macro that was TESTED and DOES work. You said "it didn't work" What does " it didn't work" mean. I tested. All you had to do was change mc = 2 to whatever column you are testing. Sub copynumbersif() Dim mc As Long Dim i As Long mc = 2 For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row If Cells(i - 1, mc) = Cells(i, mc) Then Cells(i - 1, mc - 1) = Cells(i, mc) Cells(i, mc - 1) = Cells(i, mc) End If Next i End Sub |
Copy value
Go 'horns
Gord On Mon, 7 Nov 2011 13:01:20 -0800 (PST), Don Guillett wrote: On Nov 7, 1:08*pm, gary wrote: If B4 contains the same number as A3, how can I put the number in A4? Here is my spreadsheet: * * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * * * * * * * * * * 0082768 * 5 * * * * * * * * * * 0082768 * 6 * * * * * * * * * * 0082768 * 7 * * * * * * * * * * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * * * * * * * * * * 0104409 ========= This is the result I'm looking for: * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * *0082768 * 0082768 * 5 * *0082768 * 0082768 * 6 * *0082768 * 0082768 * 7 * *0082768 * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * 0104409 * *0104409 You posted in misc and I gave you a macro that was TESTED and DOES work. You said "it didn't work" What does " it didn't work" mean. I tested. All you had to do was change mc = 2 to whatever column you are testing. Sub copynumbersif() Dim mc As Long Dim i As Long mc = 2 For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row If Cells(i - 1, mc) = Cells(i, mc) Then Cells(i - 1, mc - 1) = Cells(i, mc) Cells(i, mc - 1) = Cells(i, mc) End If Next i End Sub |
Copy value
On Nov 7, 1:09*pm, Gord Dibben wrote:
Go 'horns Gord On Mon, 7 Nov 2011 13:01:20 -0800 (PST), Don Guillett wrote: On Nov 7, 1:08*pm, gary wrote: If B4 contains the same number as A3, how can I put the number in A4? Here is my spreadsheet: * * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * * * * * * * * * * 0082768 * 5 * * * * * * * * * * 0082768 * 6 * * * * * * * * * * 0082768 * 7 * * * * * * * * * * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * * * * * * * * * * 0104409 ========= This is the result I'm looking for: * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * *0082768 * 0082768 * 5 * *0082768 * 0082768 * 6 * *0082768 * 0082768 * 7 * *0082768 * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * 0104409 * *0104409 You posted in misc and I gave you a macro that was TESTED and DOES work. You said "it didn't work" What does " it didn't work" mean. I tested. All you had to do was change mc = 2 *to whatever column you are testing. Sub copynumbersif() Dim mc As Long Dim i As Long mc = 2 For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row If Cells(i - 1, mc) = Cells(i, mc) Then Cells(i - 1, mc - 1) = Cells(i, mc) Cells(i, mc - 1) = Cells(i, mc) End If Next i End Sub- Hide quoted text - - Show quoted text - Here's more of my spreadsheet: A B 0082655 0082657 0082657 0082657 0082669 0082669 0082669 0082698 0082698 0082698 0082715 0082715 0082715 0082716 0082716 0082716 0082717 0082717 0082717 0082728 0082728 0082728 0082763 0082765 0082765 0082765 0082766 0082767 0082768 0082768 0082768 0082768 0082768 0082768 0082769 0082769 0082769 0082769 0082769 0082769 0082770 0082770 0082770 0082770 0082770 0082770 0082771 0082771 0082771 0082771 0082771 0082771 0082789 0082789 0082789 0082793 0082794 0082795 0082796 0082797 0082797 0082797 0082800 0082800 0082800 0082811 0082811 0082811 0083855 0083859 0083859 0083859 0083864 0083864 0083865 0083865 0083865 0083867 0083867 0083868 0083868 0083868 0083870 0083873 0083873 0083874 0083874 0083874 0083875 0083875 0083875 0083876 0083876 0083876 0083877 0083877 0083877 0083878 0083878 0083878 0083879 0083879 0083879 0083880 0083880 0083880 0083881 0083881 0083881 0083882 0083882 0083882 0083883 0083884 0083884 In col A, only these numbers should appear (each 4 times): 0082768 0082769 0082770 0082771 |
Copy value
On Nov 7, 1:09*pm, Gord Dibben wrote:
Go 'horns Gord On Mon, 7 Nov 2011 13:01:20 -0800 (PST), Don Guillett wrote: On Nov 7, 1:08*pm, gary wrote: If B4 contains the same number as A3, how can I put the number in A4? Here is my spreadsheet: * * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * * * * * * * * * * 0082768 * 5 * * * * * * * * * * 0082768 * 6 * * * * * * * * * * 0082768 * 7 * * * * * * * * * * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * * * * * * * * * * 0104409 ========= This is the result I'm looking for: * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * *0082768 * 0082768 * 5 * *0082768 * 0082768 * 6 * *0082768 * 0082768 * 7 * *0082768 * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * 0104409 * *0104409 You posted in misc and I gave you a macro that was TESTED and DOES work. You said "it didn't work" What does " it didn't work" mean. I tested. All you had to do was change mc = 2 *to whatever column you are testing. Sub copynumbersif() Dim mc As Long Dim i As Long mc = 2 For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row If Cells(i - 1, mc) = Cells(i, mc) Then Cells(i - 1, mc - 1) = Cells(i, mc) Cells(i, mc - 1) = Cells(i, mc) End If Next i End Sub- Hide quoted text - - Show quoted text - ======================================== Here's more of my spreadsheet: A B 0082655 0082657 0082657 0082657 0082669 0082669 0082669 0082698 0082698 0082698 0082715 0082715 0082715 0082716 0082716 0082716 0082717 0082717 0082717 0082728 0082728 0082728 0082763 0082765 0082765 0082765 0082766 0082767 0082768 0082768 0082768 0082768 0082768 0082768 0082769 0082769 0082769 0082769 0082769 0082769 0082770 0082770 0082770 0082770 0082770 0082770 0082771 0082771 0082771 0082771 0082771 0082771 0082789 0082789 0082789 0082793 0082794 0082795 0082796 0082797 0082797 0082797 0082800 0082800 0082800 0082811 0082811 0082811 0083855 0083859 0083859 0083859 0083864 0083864 0083865 0083865 0083865 0083867 0083867 0083868 0083868 0083868 0083870 0083873 0083873 0083874 0083874 0083874 0083875 0083875 0083875 0083876 0083876 0083876 0083877 0083877 0083877 0083878 0083878 0083878 0083879 0083879 0083879 0083880 0083880 0083880 0083881 0083881 0083881 0083882 0083882 0083882 0083883 0083884 0083884 In col A, only these numbers should appear (each 5 times): 0082768 0082769 0082770 0082771 |
Copy value
On Nov 7, 3:09*pm, Gord Dibben wrote:
Go 'horns Gord On Mon, 7 Nov 2011 13:01:20 -0800 (PST), Don Guillett wrote: On Nov 7, 1:08*pm, gary wrote: If B4 contains the same number as A3, how can I put the number in A4? Here is my spreadsheet: * * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * * * * * * * * * * 0082768 * 5 * * * * * * * * * * 0082768 * 6 * * * * * * * * * * 0082768 * 7 * * * * * * * * * * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * * * * * * * * * * 0104409 ========= This is the result I'm looking for: * * * * * *A * * * * * * * *B * 1 * * * * * * * * * * 0082766 * 2 * * * * * * * * * * 0082767 * 3 * *0082768 * 0082768 * 4 * *0082768 * 0082768 * 5 * *0082768 * 0082768 * 6 * *0082768 * 0082768 * 7 * *0082768 * 0082768 * 8 * * * * * * * * * * 0104361 * 9 * * * * * * * * * * 0104365 10 * * * * * * * * * * 0104367 11 * * * * * * * * * * 0104368 12 * * * * * * * * * * 0104370 13 * 0104409 * *0104409 14 * 0104409 * *0104409 You posted in misc and I gave you a macro that was TESTED and DOES work. You said "it didn't work" What does " it didn't work" mean. I tested. All you had to do was change mc = 2 *to whatever column you are testing. Sub copynumbersif() Dim mc As Long Dim i As Long mc = 2 For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row If Cells(i - 1, mc) = Cells(i, mc) Then Cells(i - 1, mc - 1) = Cells(i, mc) Cells(i, mc - 1) = Cells(i, mc) End If Next i End Sub Gord, Thanks. Looks like the University of Texas football team is on the right track back and will be playing "power football" . BTW,it's "Hook em horns" Come see me in Austin. |
Copy value
"Hook 'em horns"
I'll remember that Don. Not much chance of me getting to Austin. With my list of health issues over the past 6 years my travel insurance cost could equal your national debt. On Mon, 7 Nov 2011 15:35:26 -0800 (PST), Don Guillett wrote: Gord, Thanks. Looks like the University of Texas football team is on the right track back and will be playing "power football" . BTW,it's "Hook em horns" Come see me in Austin. |
Copy value
With my list of health issues over the past 6 years my travel
insurance cost could equal your national debt. Damn ! I'd put all my money to us bonds ! |
All times are GMT +1. The time now is 12:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com