Find letters of the group

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,360
Office Version
  1. 2010
Hello,

I have 3 groups each group has 3 letters as shown in the cells C1:K2

I have data of the group in the cells C6:F16

What I need for example...
C6 has group value 2 so extract group 2 letters D, E, F and put them in the cells H6, I6 and J6
D6 has group value 1 so extract group 1 letters A, B, C and put them in the cells L6, M6 and N6

Continue finding all the group letters and put them as shown in attached example image for a detail. Pease suggest formula or VBA

*ABCDEFGHIJKLMNOPQRSTUVWX
1Group111222333
2LetterABCDEFGHI
3
4ResultResultResultResultResultResultResultResultResultResultResultResult
5n1n2n3n4GroupGroupGroupGroupGroupGroupGroupGroupGroupGroupGroupGroup
62133DEFABCGHIGHI
72321DEFGHIDEFABC
82133DEFABCGHIGHI
93132GHIABCGHIDEF
101113ABCABCABCGHI
112231DEFDEFGHIABC
122311DEFGHIABCABC
131213ABCDEFABCGHI
143122GHIABCDEFDEF
151111ABCABCABCABC
161232ABCDEFGHIDEF
17
18
19
20
21
22

Thank you all.

I am using Excel 2000

Regards,
Moti
 

Attachments

  • Find letters of the group.png
    Find letters of the group.png
    25.5 KB · Views: 11

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Try in H6:
Code:
=IF(MOD(COLUMN(A:A)-1,4)+1=4,"",INDEX($2:$2,MATCH(INDEX($C6:$F6,INT((COLUMN(A:A)-1)/4)+1),$1:$1,0)-1+MOD(COLUMN(A:A)-1,4)+1))
Fill down and accross
 
Upvote 0
Try this
VBA Code:
Sub FillGroup()

Dim nCol As Long
Dim Grp1(), Grp2(), Grp3(), Arry()
Dim cell As Range, rngN As Range
Dim ws As Worksheet

Application.ScreenUpdating = False

Set ws = ActiveWorkbook.Sheets("Sheet1")
Set rngN = ws.Range("C6", "F16")

Grp1 = Array("A", "B", "C")
Grp2 = Array("D", "E", "F")
Grp3 = Array("G", "H", "I")

For Each cell In rngN
    Select Case cell
        Case 1
            Arry = Grp1
        Case 2
            Arry = Grp2
        Case 3
            Arry = Grp3
    End Select
    Select Case cell.Column
        Case 3
            nCol = 5
        Case 4
            nCol = 8
        Case 5
            nCol = 11
        Case 6
            nCol = 14
    End Select
        ws.Range(Cells(cell.Row, cell.Column), Cells(cell.Row, cell.Column + 2)).Offset(0, nCol) = Arry
Next
Application.ScreenUpdating = True

End Sub
 
Upvote 0
Solution
Try in H6:
Code:
=IF(MOD(COLUMN(A:A)-1,4)+1=4,"",INDEX($2:$2,MATCH(INDEX($C6:$F6,INT((COLUMN(A:A)-1)/4)+1),$1:$1,0)-1+MOD(COLUMN(A:A)-1,4)+1))
Fill down and accross
bebo021999, yes formula worked perfect.

Thank you so much for you help

Good Luck!

Kind Regards,
Moti :)
 
Upvote 0
Try this
VBA Code:
Sub FillGroup()

Dim nCol As Long
Dim Grp1(), Grp2(), Grp3(), Arry()
Dim cell As Range, rngN As Range
Dim ws As Worksheet

Application.ScreenUpdating = False

Set ws = ActiveWorkbook.Sheets("Sheet1")
Set rngN = ws.Range("C6", "F16")

Grp1 = Array("A", "B", "C")
Grp2 = Array("D", "E", "F")
Grp3 = Array("G", "H", "I")

For Each cell In rngN
    Select Case cell
        Case 1
            Arry = Grp1
        Case 2
            Arry = Grp2
        Case 3
            Arry = Grp3
    End Select
    Select Case cell.Column
        Case 3
            nCol = 5
        Case 4
            nCol = 8
        Case 5
            nCol = 11
        Case 6
            nCol = 14
    End Select
        ws.Range(Cells(cell.Row, cell.Column), Cells(cell.Row, cell.Column + 2)).Offset(0, nCol) = Arry
Next
Application.ScreenUpdating = True

End Sub
Zot, I like the macro it worked fine and find it is practical an easy to apply and use of it. (y)

Thank you so much for you help

Good Luck!

Kind Regards,
Moti :)
 
Upvote 0
Zot, I like the macro it worked fine and find it is practical an easy to apply and use of it. (y)

Thank you so much for you help

Good Luck!

Kind Regards,
Moti :)
Was trying to make it easy to understand and modified to need. Glad it is clear. For me to put formula in every rows is making file big. Maybe that's why I'm no formula expert ?
 
Upvote 0

Forum statistics

Threads
1,214,657
Messages
6,120,773
Members
448,991
Latest member
Hanakoro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top