Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8211895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:34:51+00:00 2026-06-07T10:34:51+00:00

I have the following grid of data: ———Header 1 Header 2 Header 3 Header

  • 0

I have the following grid of data:

         ---------Header 1   Header 2   Header 3   Header 4 


Row 1       x                    x          x
Row 2                  x         x
Row 3                            x          
Row 4       x          x         x          x

I then have a second sheet that looks like this:

Row 1         Row 2        Row 3        Row 4

I would like the second sheet to end up looking like this:

    Row 1         Row 2        Row 3        Row 4
  Header 1      Header 2     Header 3     Header 1
  Header 3      Header 3                  Header 2
  Header 4                                Header 3
 .                                       Header 4                                        

Ignore that last period, I just used it to format it properly.

I’ve been playing with MATCH and INDEX for a couple hours and while I can get pieces of it, I can’t seem to get it to all work together.

EDIT:

I use ‘Header 1’ and ‘Row 1’ as examples only. The actual data is text in Column A and Row 1, respectively. Also, since the source data will be modified, I’d prefer to have something that would automatically update the second sheet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:34:53+00:00Added an answer on June 7, 2026 at 10:34 am

    Here is one way to do it with a VBA function:

    In the Developer Tab(*) Click on Visual Basic, then click on the “Insert” menu there and choose “Module” to insert a new module. Then paste in the Following code:

    Option Explicit
    
    Public Function GetHeaderMatchingRow(RowText As String, _
                                        SearchRange As Range, _
                                        iHdrNo As Integer) As String
        Dim rng As Range
        Set rng = SearchRange
    
        Dim cel As Range
    
        'Get the Row to scan
        Dim i As Long, rowOff As Long
        For i = 2 To rng.Rows.Count
            Set cel = rng.Cells(i, 1)
            If cel.Value = RowText Then
                rowOff = i
                Exit For
            End If
        Next i
    
        'Now, scan horizontally for the iHdrNo'th non-blank cell
        Dim cnt As Integer
        For i = 2 To rng.Columns.Count
            Set cel = rng.Cells(rowOff, i)
            If Not CStr(cel.Value) = "" Then
                cnt = cnt + 1
                If cnt = iHdrNo Then
                    GetHeaderMatchingRow = rng.Cells(1, i).Value
                    Exit Function
                End If
            End If
        Next i
    
        GetHeaderMatchingRow = ""
    End Function
    

    Click on the “Debug” menu and select “Compile VBAProject”.

    Now go back to Excel and in your first sheet define a Named Range to cover all of your data in the grid. The Row names should be the first column in this range and the Header text should be the first row in it.

    Now go to your second sheet and enter a formula like this in every output cell:

    =GetHeaderMatchingRow(A$1, RowHeaderRange, 1)
    

    Where the First parameter is the Row text that it will try to match in the first column of the range. I have “A$1” here because the in my test, my second sheet’s column headers are also the Row-names in my first sheet, just like yours.

    The second argument is the range to search (in this case, the Named Range we defined earlier), and the third argument is the count of the match that it is looking for (1st, 2nd, 3rd, etc.).

    Note that the first and third parameters should change based on what column and row the output is for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written following to show my data into grid view. This is the
I have following code that I creating a grid var store = Ext.create('Ext.data.ArrayStore', {
I have the following code that I use to reload data in a grid.
I have a list of lists that represent a grid of data (think rows
I have to populate an Advanced Data Grid which have the following fields: Continent->State->Society-->Actual
I have the following hyperlink grid-view column that needs to be sorted numerically by
Context: I have a data grid where the following has been implemented. tabbing through
I have a data grid loading row event _gridObj.LoadingRow += new EventHandler<DataGridRowEventArgs>(_gridObj_LoadingRow); and in
I have the following XAML inside a 4 Row by 2 column grid. The
I have the following case:: Before: one Grid view ,,this grid view has two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.