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 8767275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:46:11+00:00 2026-06-13T16:46:11+00:00

I have an xls file that looks this way: https://i.stack.imgur.com/d2fux.png Well, and that’s sth

  • 0

I have an xls file that looks this way:

https://i.stack.imgur.com/d2fux.png

Well, and that’s sth like the same piece of info that depends on the headers, in this case the header is the row 22164, next header is 22178, and so on.

In the GUI, i have something that let users choose from parameters, and option to load the info from the xls file depending on their choices, for example, they can choose:

WR | random | 4 | 6 | 15

looking in that case for the info stored in A22165:O22177

I have already the sheet with all the info in the workbook, let’s call that object[,] ‘valueArray’:

Workbook workBook = _excelApp.Workbooks.Open(censFilePath);
        Worksheet sheet = (Worksheet)workBook.Sheets[1];
        Range sheetRange = sheet.UsedRange;
        object[,] valueArray = 
            (object[,])sheetRange.get_Value(XlRangeValueDataType.xlRangeValueDefault);

and I have created another object that stores the user’s choices in the same order and format that the xls has. Let’s call that object[,] sth like ‘look4it’

I’m trying to find a method that I can tell: I want to find ‘look4it’ in ‘valueArray’, and that method’s answer would be A22164:E22164 so I can after that calculate the range to copy from ‘valueArray’ and use the correct info.

I’ve tried Range.Find but it seems to be that looks for a unique piece of info within a Range, and returns the address, but I’ve found nothing that allows me to looks for a Range’s content within another one.

Any help is appreciated!

  • 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-13T16:46:13+00:00Added an answer on June 13, 2026 at 4:46 pm

    I think what I would do in this scenario is first construct a look-up list consisting of each header and its location. For the key in the list, I would concatenate the header cells together to make a single look-up value. So following on immediately after your code:

    Dictionary<string, int> lookUpList = new Dictionary<string, int>();
    
    // Loop through the rows
    
    for (int i = 0; i < valueArray.GetLength(0); i++)
    {
        // Identify the header rows
    
        if (valueArray[i, 0].ToString() == "WR")
        {
            // Concatenate the header strings into a single string
    
            string header = "";
    
            for (int j = 0; j < valueArray.GetLength(1); j++)
            {
                header += valueArray[i, j].ToString();
            }
    
            // Store the header location
    
            lookUpList.Add(header, i + 1);
        }
    }
    

    Bear in mind that this is extempore and I haven’t tested it. I’m not sure exactly how the Range.get_Value method places data into the array, so the dimensions might be the wrong way around. Also I’m making assumptions about how to identify header rows in your spreadsheet based on the image of the data you supplied.

    Anyway, once constructed you can perform a simple look up to extract the row number of the header:

    string userSelectedHeader = "concatenation of whatever the user selected";
    int rowNumber = lookUpList[userSelectedHeader];
    

    Does that go some way to helping answer your question?

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

Sidebar

Related Questions

I have a link being generated that looks like so: <a target=_blank title=Test href=file:///c:/test.xls>Test</a>
So I have this small xls file that's actually a tab-delimited txt file. In
I have a generated xls file on my server that I would like to
I have an xls. file that contains the following information I want to delete
I have the need to download a file that is hidden behind an HTTPS
I have developed a C# script that opens an XLS file, parses it and
I have a page that creates an xls file with PHPExcel on post, which
I have this script that I'd like to in addition save as a xls
I am using this Spreadsheet gem to export xls file. I have the following
I have created password protected zip file which has xls file with the help

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.