[VIEWED 7314
TIMES]
|
SAVE! for ease of future access.
|
|
|
jhyaikuti
Please log in to subscribe to jhyaikuti's postings.
Posted on 05-19-09 11:11
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
i have six columns in excel. A B C D E F. i need to compare A with D, B with E and C with F(row by row)..and see if all three match. is there any formula to highlight the rows(by giving it different color, or presenting in BOLD or any other mechanism) A matches with D, B matches with E and C matches with F? plz help if anyone has any idea on excel formulas....
|
|
|
|
Prad
Please log in to subscribe to Prad's postings.
Posted on 05-19-09 2:50
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
I have been trying to learn it myself for sometime now.. There is no easy way. You need to use macro in excel... For using macro in Excel http://office.microsoft.com/en-us/excel/HA101736551033.aspx#11 Create new macro with following code and run Here is the code for you Sub bolding() Dim r As Integer For r = 1 To ActiveSheet.UsedRange.Rows.Count If Cells(r, 1).Value = Cells(r, 4).Value Then Range("A" & r).EntireRow.Font.ColorIndex = 10 ElseIf Cells(r, 2).Value = Cells(r, 5).Value Then Range("A" & r).EntireRow.Font.Bold = True ElseIf Cells(r, 3).Value = Cells(r, 6).Value Then Range("A" & r).EntireRow.Font.ColorIndex = 3 End If Next r End Sub Error handling can be improved..... Enjoy
|
|
|
_
Please log in to subscribe to _'s postings.
Posted on 05-19-09 3:15
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Answer to your first question is =AND(A1=D1,B1=E1,C1=F1) Excel does the second part, probably Prad is correct, I don't know.
Last edited: 19-May-09 03:18 PM
|
|
|
calciteko
Please log in to subscribe to calciteko's postings.
Posted on 05-19-09 7:03
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
You can solve this problem entirely in EXCEL here is the formula =IF(EXACT(A1,B1),IF(EXACT(B1,C1),IF(EXACT(C1,D1),IF(EXACT(D1,E1),IF(EXACT(E1,F1),"TRUE","FALSE"),"FALSE"),"FALSE"),"FALSE"),"FALSE") This should work. However I use Excel 2007 so 2003 might be little different. But I think this should work in 2003 as well.
|
|
|
rajeshHamal
Please log in to subscribe to rajeshHamal's postings.
Posted on 05-19-09 10:55
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
option explicit Sub sajha() 'vba for excel to 'determine if the adjacent cells have equal value 'declare variables Dim myData As Range Dim myRow As Range Dim myCell As Range Dim colCount As Long Dim leftCell As Range Dim rightCell As Range 'assign range Set myData = Selection 'remove previous color myData.Interior.ColorIndex = xlColorIndexNone For Each myRow In myData.Rows colCount = 0 For Each myCell In myRow.Cells colCount = colCount + 1 'test for odd numbered columns in selection If (colCount / 2 - colCount \ 2 <> 0) Then Set leftCell = myCell Set rightCell = myCell.Offset(0, 1) If leftCell.Value = rightCell.Value Then leftCell.Interior.Color = vbGreen rightCell.Interior.Color = vbGreen End If End If Next Next End Sub
|
|
|
rajeshHamal
Please log in to subscribe to rajeshHamal's postings.
Posted on 05-19-09 11:08
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
'INSTRUCTION : 'Add the following in vba module window [Alt+F11] 'select a block of cells containing data 'then run the code 'matching data will be colored green Option explicit Sub sajha() 'declare variables Dim myData As Range Dim myRow As Range Dim myCell As Range Dim colCount As Long Dim leftCell As Range Dim rightCell As Range 'assign range Set myData = Selection 'remove previous color myData.Interior.ColorIndex = xlColorIndexNone For Each myRow In myData.Rows colCount = 0 For Each myCell In myRow.Cells colCount = colCount + 1 'test for odd numbered columns in selection If (colCount / 2 - colCount \ 2 <> 0) Then Set leftCell = myCell Set rightCell = myCell.Offset(0, 1) If leftCell.Value = rightCell.Value Then leftCell.Interior.Color = vbGreen rightCell.Interior.Color = vbGreen End If End If Next Next End Sub
|
|
|
rajeshHamal
Please log in to subscribe to rajeshHamal's postings.
Posted on 05-20-09 12:30
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
'compares a to d, b to e.. like that 'but it is more generic 'you can select any range of data 'as long as columns count is even Option Explicit Option Base 1 Sub sajha2() Dim c As Long Dim r As Long Dim leftCell As Range Dim rightCell As Range Dim leftRange As Range Dim rightRange As Range Dim myRange As Range Set myRange = Selection myRange.Interior.ColorIndex = xlColorIndexNone Dim colCount As Long Dim rowCount As Long colCount = myRange.Columns.count rowCount = myRange.Rows.count Dim topLeft As Range Dim botRight As Range 'create two data ranges 'left part Set topLeft = myRange.Cells(1, 1) Set botRight = myRange.Cells(rowCount, colCount / 2) Set leftRange = Range(topLeft, botRight) 'right part Set topLeft = myRange.Cells(1, colCount / 2 + 1) Set botRight = myRange.Cells(rowCount, colCount) Set rightRange = Range(topLeft, botRight) 'processing For r = 1 To rowCount For c = 1 To leftRange.Columns.count Set leftCell = leftRange.Cells(r, c) Set rightCell = rightRange.Cells(r, c) If leftCell.Value = rightCell.Value Then leftCell.Interior.Color = vbGreen rightCell.Interior.Color = vbGreen End If Next c Next r End Sub
|
|
|
बैरागिकाइलो
Please log in to subscribe to बैरागिकाइलो's postings.
Posted on 05-21-09 5:03
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Can you paste the problem?
|
|