+ Reply to Thread
Results 1 to 16 of 16

Search for string, report row

  1. #1
    Registered User
    Join Date
    11-04-2009
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Search for string, report row

    I have a somewhat odd need. I have 18 each with 2 sheets (will probably add them into 1 excel file). The sheets are listed by government program and I need to do averages for different programs. The problem is that if NJ doesn't have the program then it gets out. So Education Pensions might be row 45 for NJ but row 47 for NYC. But, each program has a unique identifier. So instead of specifying a sheet, column and row, I want to specify the sheet and column and have a function that repots the row.

    Is there a way to do this in Excel 2007?

  2. #2
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Search for string, report row

    If you have a common identifier you can use VLOOKUP

    =VLookup( value, table_array, index_number, not_exact_match )

  3. #3
    Registered User
    Join Date
    11-04-2009
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Search for string, report row

    Quote Originally Posted by jj72uk View Post
    If you have a common identifier you can use VLOOKUP

    =VLookup( value, table_array, index_number, not_exact_match )
    Hi and thanks. I've tried vlookup but it doesn't seem to work. The two problems with it are:

    1) Some of my identifiers are: "1543.AAA". vlookup gives me an error in searching for that.
    2) vlookup doesn't report the row, it reports the value. The problem is I don't want the value in the unique identifer, I want the value two columns to the left of that unique identifier. Is there any way I can get that?

  4. #4
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Search for string, report row

    If you could post a sheet it would help.

    If you have a unique indetifier and you want to get the value from 2 columns left then you'll need to combine INDEX with MATCH

    Post a sheet, let me look.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Search for string, report row

    It sounds like you will be using MATCH, and maybe INDEX (to report the value two columns to the left of your found match). As JJ stated, it would help immensely if you uploaded an example spreadsheet showing examples of your layout and what you want to achieve.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Registered User
    Join Date
    11-04-2009
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Search for string, report row

    Here is the workbook with just two states. For the example problem I'll give I'm looking at sheets: CTFedSpendList and DEFedSpendList.


    WILDLIFE HABITAT INCENTIVE PROGRAM
    Identififer (column G): 10.914
    Connecticut: Row 86
    Delaware: Row 78

    So, instead of doing CT per capita spending I want to do the per capita spending of CT and DE (don't worry about populations, I can easily make a table for them to draw from) but I want to automat adding the numbers from these programs together across these 2 worksheets even though they are on different rows. (Ultimately, I'm doing 18 states.)

    Any help on that would be amazing!


    Secondary question: When I moved the CT sheets into the DE file it now looks for USMaster1 on my C:\ Drive... even though the USMaster1 file is the same in both workbooks... is there a way to make it reference sheet in the new workbook?

    Thank you
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Search for string, report row

    So, instead of doing CT per capita spending I want to do the per capita spending of CT and DE
    You want to add them?

  8. #8
    Registered User
    Join Date
    11-04-2009
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Search for string, report row

    Quote Originally Posted by jj72uk View Post
    You want to add them?
    Yeah, all I need is to be able to add the money the two states got for any given program in a generalizable form which will allow me to do this for my 18 states over 1,000+ programs. Which means I can't manually input the row number each time.

  9. #9
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Search for string, report row

    Something like this?

    =INDEX(CTFedSpendList!D:D,MATCH(G86,CTFedSpendList!G:G,0))+INDEX(DEFedSpendList!D:D,MATCH(G86,DEFedSpendList!G:G,0))
    Last edited by jj72uk; 11-04-2009 at 03:00 PM.

  10. #10
    Registered User
    Join Date
    11-04-2009
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Search for string, report row

    Quote Originally Posted by jj72uk View Post
    Something like this?

    =INDEX(CTFedSpendList!D:D,MATCH(G86,CTFedSpendList!G:G,0))+INDEX(DEFedSpendList!D:D,MATCH(G86,DEFedSpendList!G:G,0))
    Ah, interesting. I am getting errors and in trying to narrow it down I just used match (which seems promising).

    Matching a value on the same sheet I did "=MATCH(96.006,DEFedSpendListG:G,0)" and it reported row 33 which is correct!

    But now I want to add the value in B33 ($323247103)with some other number. How do I do that?

    "=SUM(B=MATCH(96.006,DEFedSpendListG:G,0),5)" doesn't seem to work. So I can't combine the column letter that I know and the row number that I get from =Match and put that into a =Sum?

    Thanks for your help! It seemed really promising but I can't seem to figure out that one piece.

  11. #11
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Search for string, report row

    The reason why it doesnt work if you copy and paste directly is the forum has added a uncanny space.

    Try copying this

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    11-04-2009
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Search for string, report row

    Quote Originally Posted by jj72uk View Post
    The reason why it doesnt work if you copy and paste directly is the forum has added a uncanny space.

    Try copying this

    Please Login or Register  to view this content.
    I had removed the space and pasting the code also gives me an N/A.

    And btw this is exactly what I was looking for. Index works as it should... and so does match... but I can't put a Match inside an index even on the same sheet without it giving me an error. Can you nest a match inside an index?
    Last edited by grenavitar; 11-04-2009 at 03:45 PM. Reason: Removed my edit

  13. #13
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Search for string, report row

    A nested INDEX MATCH has no problem working together!

    I saw before you removed it that you have removed the cell reference with an actual figure, wether numerical or alpha-numerical, this, I think is the problem.

    If you just use a cell reference does it work?

  14. #14
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Search for string, report row

    Numeric cells such as 10.914 will work fine, if you are using alpha-numeric you will need to add "" to it

    eg

    "17.FEC"

  15. #15
    Registered User
    Join Date
    11-04-2009
    Location
    DC
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Search for string, report row

    =Index(B:B,=MATCH(16.571,G:G,0))

    For alphanumeric putting in " " is necessary, took me a while to realize that.

    Hmmm, I just saw yours work. I'm not sure how or what I did but the nesting worked with no problem. I'm going to compare it to what I did wrong and hopefully find the answer that will work over all cases. Thank you _very_ much for your help!

    EDIT: And one other question.

    If the number doesn't exist on a sheet it gives me #N/A. Is there any way to make numbers that don't come up as 0 so when they are added up instead of making the function not work?
    Last edited by grenavitar; 11-04-2009 at 05:01 PM.

  16. #16
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Search for string, report row

    Something like

    =IF(ISNA(Index(B:B,MATCH(16.571,G:G,0),0,Index(B:B,MATCH(16.571,G:G,0))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1