Ana içeriğe atla

 Bir sütundaki hücreleri başka bir sütundaki benzersiz değerlere göre nasıl aktarabilirim?

Diyelim ki, iki sütun içeren bir veri aralığınız var, şimdi, aşağıdaki sonucu elde etmek için bir sütundaki hücreleri başka bir sütundaki benzersiz değerlere dayalı olarak yatay satırlara dönüştürmek istiyorsunuz. Excel'de bu sorunu çözmek için iyi fikirleriniz var mı?

doc benzersiz değerleri aktarın 1

Formüller ile benzersiz değerlere göre hücreleri bir sütunda değiştirin

VBA kodu ile benzersiz değerlere göre hücreleri bir sütunda değiştirin

Kutools for Excel ile hücreleri benzersiz değerlere göre bir sütunda değiştirin


Aşağıdaki dizi formülleriyle, benzersiz değerleri çıkarabilir ve bunlara karşılık gelen verileri yatay satırlara aktarabilirsiniz, lütfen aşağıdaki işlemleri gerçekleştirin:

1. Şu dizi formülünü girin: = ENDEKS ($ A $ 2: $ A $ 16, EŞLEŞTİR (0, EĞERSAY ($ D $ 1: $ D1, $ A $ 2: $ A $ 16), 0)) örneğin D2 gibi boş bir hücreye girin ve ÜstKrktr + Ctrl + Enter doğru sonucu almak için anahtarları bir araya getirin, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 2

not: Yukarıdaki formülde, A2: A16 benzersiz değerleri listelemek istediğiniz sütundur ve D1 bu formül hücresinin üstündeki hücredir.

2. Ardından, tüm benzersiz değerleri çıkarmak için dolgu tutamacını hücrelere sürükleyin, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 3

3. Ve sonra bu formülü E2 hücresine girmeye devam edin: =IFERROR(INDEX($B$2:$B$16, MATCH(0, COUNTIF($D2:D2,$B$2:$B$16)+IF($A$2:$A$16<>$D2, 1, 0), 0)), 0)ve basmayı unutma ÜstKrktr + Ctrl + Enter sonucu almak için anahtarlar, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 4

not: Yukarıdaki formülde: B2: B16 sırasını değiştirmek istediğiniz sütun verileridir, A2: A16 değerleri temel alarak değiştirmek istediğiniz sütundur ve D2 1. Adımda çıkardığınız benzersiz değeri içerir.

4. Ardından doldurma tutamacını, sırasını değiştirmiş verileri listelemek istediğiniz hücrelerin sağına 0 görüntülenene kadar sürükleyin, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 5

5. Ardından, aşağıda gösterilen ekran görüntüsü gibi dönüştürülmüş verileri almak için dolgu tutamacını hücre aralığına sürüklemeye devam edin:

doc benzersiz değerleri aktarın 6


Formüller anlamanız için karmaşık olabilir, burada ihtiyacınız olan istenen sonucu elde etmek için aşağıdaki VBA kodunu çalıştırabilirsiniz.

1. Basılı tutun ALT + F11 tuşlarını açmak için Uygulamalar için Microsoft Visual Basic pencere.

2. tıklayın Ekle > modülve aşağıdaki kodu modül Pencere.

VBA kodu: Bir sütundaki hücreleri başka bir sütundaki benzersiz değerlere göre değiştirin:

Sub transposeunique()
'updateby Extendoffice
    Dim xLRow As Long
    Dim i As Long
    Dim xCrit As String
    Dim xCol  As New Collection
    Dim xRg As Range
    Dim xOutRg As Range
    Dim xTxt As String
    Dim xCount As Long
    Dim xVRg As Range
    On Error Resume Next
    xTxt = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("please select data range(only two columns):", "Kutools for Excel", xTxt, , , , , 8)
    Set xRg = Application.Intersect(xRg, xRg.Worksheet.UsedRange)
    If xRg Is Nothing Then Exit Sub
    If (xRg.Columns.Count <> 2) Or _
       (xRg.Areas.Count > 1) Then
        MsgBox "the used range is only one area with two columns ", , "Kutools for Excel"
        Exit Sub
    End If
    Set xOutRg = Application.InputBox("please select output range(specify one cell):", "Kutools for Excel", xTxt, , , , , 8)
    If xOutRg Is Nothing Then Exit Sub
    Set xOutRg = xOutRg.Range(1)
    xLRow = xRg.Rows.Count
    For i = 2 To xLRow
        xCol.Add xRg.Cells(i, 1).Value, xRg.Cells(i, 1).Value
    Next
    Application.ScreenUpdating = False
    For i = 1 To xCol.Count
        xCrit = xCol.Item(i)
        xOutRg.Offset(i, 0) = xCrit
        xRg.AutoFilter Field:=1, Criteria1:=xCrit
        Set xVRg = xRg.Range("B2:B" & xLRow).SpecialCells(xlCellTypeVisible)
        If xVRg.Count > xCount Then xCount = xVRg.Count
        xRg.Range("B2:B" & xLRow).SpecialCells(xlCellTypeVisible).Copy
        xOutRg.Offset(i, 1).PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
        Application.CutCopyMode = False
    Next
    xOutRg = xRg.Cells(1, 1)
    xOutRg.Offset(0, 1).Resize(1, xCount) = xRg.Cells(1, 2)
    xRg.Rows(1).Copy
    xOutRg.Resize(1, xCount + 1).PasteSpecial Paste:=xlPasteFormats
    xRg.AutoFilter
    Application.ScreenUpdating = True
End Sub

3. Daha sonra tuşuna basın. F5 Bu kodu çalıştırmak için bir tuşa basın ve kullanmak istediğiniz veri aralığını seçmenizi hatırlatmak için bir istem kutusu açılır, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 7

4. Ve sonra tıklayın OK düğmesi, sonucu koymak için bir hücre seçmenizi hatırlatmak için başka bir istem kutusu açılır, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 8

6. tıklayın OK düğmesi ve B sütunundaki veriler A sütunundaki benzersiz değerlere göre aktarılmıştır, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 9


Eğer varsa Kutools for Excel, birleştirerek Gelişmiş Kombine Satırları ve Bölünmüş hücreler yardımcı programlar, bu görevi herhangi bir formül veya kod olmadan hızlı bir şekilde tamamlayabilirsiniz.

Kutools for Excel : 300'den fazla kullanışlı Excel eklentisi ile 30 günde sınırlama olmaksızın ücretsiz deneyin.

Kurduktan sonra Kutools for Excellütfen aşağıdaki işlemleri yapın:

1. Kullanmak istediğiniz veri aralığını seçin. (Orijinal verileri saklamak istiyorsanız, lütfen önce verileri kopyalayıp başka bir yere yapıştırın.)

2. Sonra tıklayın Kutools > Birleştir ve Böl > Gelişmiş Kombine Satırları, ekran görüntüsüne bakın:

3. In Sütuna Göre Satırları Birleştirme iletişim kutusu, lütfen aşağıdaki işlemleri yapın:

(1.) Verileri temel alarak dönüştürmek istediğiniz sütun adını tıklayın ve Birincil anahtar;

(2.) Sırasını değiştirmek istediğiniz başka bir sütuna tıklayın ve Birleştirmek daha sonra, boşluk, virgül, noktalı virgül gibi birleştirilmiş verileri ayırmak için bir ayırıcı seçin.

doc benzersiz değerleri aktarın 11

4. Sonra tıklayın Ok düğmesi, B sütunundaki veriler A sütununa göre tek bir hücrede birleştirildi, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 12

5. Ve sonra birleştirilmiş hücreleri seçin ve Kutools > Birleştir ve Böl > Bölünmüş hücreler, ekran görüntüsüne bakın:

6. In Bölünmüş hücreler iletişim kutusunu seçin Sütunlara Böl altında Tip seçeneğini seçin ve ardından birleştirilmiş verilerinizi ayıran ayırıcıyı seçin, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 14 14

7. Sonra tıklayın Ok düğmesini tıklayın ve bölünme sonucunu açılan iletişim kutusuna koymak için bir hücre seçin, ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 15

8. tıklayın OKve sonucu ihtiyacınız olduğu kadar alacaksınız. Ekran görüntüsüne bakın:

doc benzersiz değerleri aktarın 16

Kutools for Excel'i şimdi indirin ve ücretsiz deneyin!


Kutools for Excel: 300'den fazla kullanışlı Excel eklentisi ile 30 günde sınırlama olmaksızın ücretsiz deneyin. Hemen indirin ve ücretsiz deneme!

En İyi Ofis Üretkenlik Araçları

🤖 Kutools AI Yardımcısı: Aşağıdakilere dayalı olarak veri analizinde devrim yaratın: Akıllı Yürütme   |  Kodunu oluşturun  |  Özel Formüller Oluşturun  |  Verileri Analiz Edin ve Grafikler Oluşturun  |  Kutools İşlevlerini Çağır...
Popüler Özellikler: Yinelenenleri Bul, Vurgula veya Tanımla   |  Boş Satırları Sil   |  Veri Kaybı Olmadan Sütunları veya Hücreleri Birleştirin   |   Formülsüz Tur ...
Süper Arama: Çoklu Ölçütlü VLookup    Çoklu Değer VLookup  |   Birden Çok Sayfada VLookup   |   Bulanık Arama ....
Gelişmiş Açılır Liste: Hızla Açılır Liste Oluşturun   |  Bağımlı Açılır Liste   |  Çoklu Seçim Açılır Liste ....
Sütun Yöneticisi: Belirli Sayıda Sütun Ekleme  |  Sütunları Taşı  |  Gizli Sütunların Görünürlük Durumunu Değiştir  |  Aralıkları ve Sütunları Karşılaştırın ...
Öne Çıkan Özellikler: Izgara Odağı   |  Tasarım görünümü   |   Büyük Formül Çubuğu    Çalışma Kitabı ve Sayfa Yöneticisi   |  Kaynak Kütüphanesi (Otomatik metin)   |  Tarih Seçici   |  Çalışma Sayfalarını Birleştirin   |  Hücreleri Şifrele/Şifresini Çöz    E-postaları Listeye Göre Gönder   |  Süper Filtre   |   Özel Filtre (kalın/italik/üstü çizili filtre...) ...
En İyi 15 Araç Seti12 Metin Tools (Metin ekle, Karakterleri Kaldır, ...)   |   50+ Grafik Türleri (Gantt şeması, ...)   |   40+ Pratik Formüller (Yaşı doğum gününe göre hesapla, ...)   |   19 sokma Tools (QR Kodunu Girin, Yoldan Resim Ekle, ...)   |   12 Dönüştürme Tools (Sayılardan Kelimelere, Para Birimi Dönüştürme, ...)   |   7 Birleştir ve Böl Tools (Gelişmiş Kombine Satırları, Bölünmüş hücreler, ...)   |   ... ve dahası

Kutools for Excel ile Excel Becerilerinizi Güçlendirin ve Daha Önce Hiç Olmadığı Gibi Verimliliği Deneyimleyin. Kutools for Excel, Üretkenliği Artırmak ve Zamandan Tasarruf Etmek için 300'den Fazla Gelişmiş Özellik Sunar.  En Çok İhtiyacınız Olan Özelliği Almak İçin Buraya Tıklayın...

Açıklama


Office Tab, Office'e Sekmeli Arayüz Getirir ve İşinizi Çok Daha Kolay Hale Getirir

  • Word, Excel, PowerPoint'te sekmeli düzenlemeyi ve okumayı etkinleştirin, Publisher, Access, Visio ve Project.
  • Yeni pencereler yerine aynı pencerenin yeni sekmelerinde birden çok belge açın ve oluşturun.
  • Üretkenliğinizi% 50 artırır ve her gün sizin için yüzlerce fare tıklamasını azaltır!
Comments (56)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Like many people in the below my column "b" has duplicates I still want to appear in a column, I.e. 
How to do the transpose if B column doesn't have unique values but still need those values
KTE 100
KTE 100

Can you shared a modified equation that works in that scenario? I appears lots of people have this question below without an answer.
Thank you, 
This comment was minimized by the moderator on the site
have you solve the problem?
This comment was minimized by the moderator on the site
Hello, Alicia,If there are duplicate values in the second column, you should apply the below array formula:=IFERROR(INDEX($B$2:$B$16,SMALL(IF($D2=$A$2:$A$16,ROW($A$2:$A$16)-ROW($A$2)+1),COLUMN(A1))),"")
After inserting the formula, please remember to press Shift + Ctrl + Enter keys.
Please try, hope it can help you!
This comment was minimized by the moderator on the site
how would you do the first order but with multiple columns of data for each product? Like if KTO and KTE had multiple pieces of data in columns C, D, E,...

This was the formula used:

=IFERROR(INDEX($B$2:$B$16, MATCH(0, COUNTIF($D2:D2,$B$2:$B$16)+IF($A$2:$A$16<>$D2, 1, 0), 0)), 0)
This comment was minimized by the moderator on the site
thanks !! just what i was looking for !! works as intended !!
This comment was minimized by the moderator on the site
this was a very, very helpful post - thank you!
I found the VBA version did not yield the expected results at least when running in VBA 7.1 (Excel for Office 365 - 16.0.x - 64-bit). I tweaked it a bit to get the results I wanted:


Sub transposeunique()

'updateby Extendoffice

'updateby skipow June 2020

Dim xLRow As Long

Dim i As Long

Dim xCrit As String

Dim xCritLast As String

Dim xCol As New Collection

Dim xRg As Range

Dim xOutRg As Range

Dim xTxt As String

Dim xCount As Long

Dim xVRg As Range

On Error Resume Next

xTxt = ActiveWindow.RangeSelection.Address

Set xRg = Application.InputBox("please select data range(only two columns):", "Kutools for Excel", xTxt, , , , , 8)

Set xRg = Application.Intersect(xRg, xRg.Worksheet.UsedRange)

If xRg Is Nothing Then Exit Sub

If (xRg.Columns.Count <> 2) Or _

(xRg.Areas.Count > 1) Then

MsgBox "the used range is only one area with two columns ", , "Kutools for Excel"

Exit Sub

End If

Set xOutRg = Application.InputBox("please select output range(specify one cell):", "Kutools for Excel", xTxt, , , , , 8)

If xOutRg Is Nothing Then Exit Sub

Set xOutRg = xOutRg.Range(1)

xLRow = xRg.Rows.Count

For i = 2 To xLRow

'xCol.Add xRg.Cells(i, 1).Value, xRg.Cells(i, 1).Value

'the above line commented out - the Add function to the Collection (at least in VBA 7.1) doesn't accept this format

xCol.Add Item:=xRg.Cells(i, 1).Value

'you only need the first column put into the Collection



Next

Application.ScreenUpdating = False

For i = 1 To xCol.Count

xCrit = xCol.Item(i)

'if you don't keep track of the last entry and compare to the next entry you'll get duplicate lines

If xCrit = xCritLast Then

xRg.AutoFilter

Else

xOutRg.Offset(i, 0) = xCrit

xRg.AutoFilter Field:=1, Criteria1:=xCrit

Set xVRg = xRg.Range("B2:B" & xLRow).SpecialCells(xlCellTypeVisible)

If xVRg.Count > xCount Then xCount = xVRg.Count

xRg.Range("B2:B" & xLRow).SpecialCells(xlCellTypeVisible).Copy

xOutRg.Offset(i, 1).PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True

Application.CutCopyMode = False

'save the last entry and compare above to the next one to avoid duplicates

xCritLast = xCrit

End If

Next

xOutRg = xRg.Cells(1, 1)

xOutRg.Offset(0, 1).Resize(1, xCount) = xRg.Cells(1, 2)

xRg.Rows(1).Copy

xOutRg.Resize(1, xCount + 1).PasteSpecial Paste:=xlPasteFormats

xRg.AutoFilter

Application.ScreenUpdating = True

End Sub
This comment was minimized by the moderator on the site
This works, but it gives me duplicates. Is there a way to make it not?
This comment was minimized by the moderator on the site
it worked for me, i had to sort the first column though
This comment was minimized by the moderator on the site
can you please share the code if there are 2 columns to be copied instead of 1. below is the example.
This comment was minimized by the moderator on the site
I have a data set which has 3 columns presented below:



Column A Column B Column C



Country1 Year1 Value1

Country1 Year2 Value2

Country1 Year3 Value3,



Country2 Year1 Value1

Country2 Year3 Value3,

...........



I need to combine these 3 columns in a table like this:

Year1 Year2 Year3 ................................. YearX



Country1 Value1 Value2 Value3

Country2 Value1 #Missing Value3

.....
.....
.....

CountryX Valuex ..................





The problem i am facing is that for some data in column A i don't have values for each year only for some.(For example country 2 has missing values for Year 2)





Is there a way to work around this issue and resolve it?



Thank you in advance!
This comment was minimized by the moderator on the site
I have a data set which has multiple IDs in column A, and has connected data in column B. I used the above formula and altered it a bit so that I am transposing the cells in the column B into a row based on the unique ID tied to it in column A. The formula used to identify the unique IDs is: =INDEX($A$2:$A$13409, MATCH(0, COUNTIF($D$1:$D1, $A$2:$A$13409), 0)). The formula used to do the transposing is: =IFERROR(INDEX($B$2:$B$13409, MATCH(0, IF($A$2:$A$13409<>$D2, 1, 0)+COUNTIF($D2:D2,$B$2:$B$13409), 0)), "N/A"). Both given in the article, only slightly altered.

The issue is my data set in column B has duplicates, sometimes appearing one after another, and I need all of the values in the column to be presented in the rows.

The image attached is what I would like the table to show (this is a small sample size, the true dataset has over 13,000 entries). What is happening now is when a repeat value is encountered, it will not count it.
i.e. Row 9 for ID 11980 now only shows 0 -31.79 -0.19 -0.74 N/A N/A .... when what I need it to show instead is 0 0 -31.79 -0.19 -0.74 0 0 N/A N/A ....

Is there a way to work around this issue and resolve it?

Thank you in advance!
This comment was minimized by the moderator on the site
Did you ever get a response/resolution to this challenge? I have the same one.
This comment was minimized by the moderator on the site
I have a data set in Columns A (Unique ID) - E. Each row has data based on the ID#, there are multiple rows for each ID# but I want one row per ID# with all of the other data in columns (it would be 5 columns long minimum and 25 maximum depending on how many each unique ID has). I found a code but it only works for two columns. I had to concatenate the four columns (not including ID) then delimit after running the macro (lot of work). For 15,000 rows of data this is extra time consuming. Is there an endless column macro that would work? Thanks in advance everyone for your help!
ID CODE ST CODE# DATE
This comment was minimized by the moderator on the site
The macro did not work. It just copied the contents in cell A1.
This comment was minimized by the moderator on the site
=INDEX($A$2:$A$16, MATCH(0, COUNTIF($D$1:$D1, $A$2:$A$16), 0)) worked for me to transpose the unique values of A column into a new column BUT...is there a way to get the all the values in B column to be transposed as given below:

Product Order Date Product Order Order Order Order Order Order Order
KTE 100 3/3/2019 KTE 100 100 100 200 100 150 100
KTO 150 3/3/2019 KTO 150 100 200 100 150 200
KTE 100 3/4/2019 BOT 150 100 200 150 100 200
KTO 100 3/4/2019 COD 200 150 100 150
KTO 200 3/5/2019
KTE 100 3/5/2019
BOT 150 3/5/2019
BOT 100 3/6/2019
KTO 100 3/6/2019
KTE 200 3/6/2019
BOT 200 3/7/2019
COD 200 3/7/2019
KTE 100 3/7/2019
KTO 150 3/7/2019
BOT 150 3/8/2019
KTE 150 3/8/2019
COD 150 3/8/2019
BOT 100 3/9/2019
BOT 200 3/10/2019
COD 100 3/10/2019
KTO 200 3/10/2019
COD 150 3/11/2019
KTE 100 3/11/2019
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations