+ Reply to Thread
Results 1 to 9 of 9

Search one column, then rows and the return adjacent cell value

  1. #1
    Registered User
    Join Date
    08-09-2016
    Location
    Las Vegas, NV.
    MS-Off Ver
    2010
    Posts
    5

    Question Search one column, then rows and the return adjacent cell value

    I have a really weird set up I am trying to figure out.

    I have data that is, unfortunately, set up like this:
    Example Table.JPG

    On different tabs within the same workbook, each one named for a separate Region, all the Districts within each Region are set up like this:
    Example Table 2.JPG

    I need a formula that I can pull the TOTAL from each District on the DATA SHEET TAB and place it in the appropriate month’s column on the REPORT tab.

    I would pull the data once a month, copy it from the stupid report that is formatted the way I have shown in the “DATA SHEET TAB” image above, and paste it into my workbook either on a separate tab for each month (i.e. DATA SHEET – JAN, DATA SHEET – FEB, etc.) or past it into sections of one DATA SHEET TAB that is broken down into months.

    I was originally looking for a formula that would look on the DATA SHEET TAB, in column A for the District Name, find the first instance of the word “TOTAL” in the rows immediately following it and return the value one cell to the right of the word “TOTAL.” Trying to figure out how to do that has been impossible. That’s why I am here. I am not experienced in VBA so if your solution is there, I will need VERY detailed instructions.

    Thanks!!

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Search one column, then rows and the return adjacent cell value

    Please post a sample file]

    To upload file click "Go Advanced" then scroll down to "Manage Attachments"

  3. #3
    Registered User
    Join Date
    08-09-2016
    Location
    Las Vegas, NV.
    MS-Off Ver
    2010
    Posts
    5

    Question Re: Search one column, then rows and the return adjacent cell value

    I hope this makes sense. Sample file attached. Thanks for any help you can offer.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Search one column, then rows and the return adjacent cell value

    I used this formula in I4

    =IFERROR(INDEX('DATA SHEET'!$A$1:$N$750,MATCH($A$1& " / " &$B2,'DATA SHEET'!$A$1:$A$750,0)+3,5),0)

    Copy and paste to other rows.

    I put data in July 2016 as there is no date entered in the "DATA SHEET": is the date to be in A3 etc ?

  5. #5
    Registered User
    Join Date
    08-09-2016
    Location
    Las Vegas, NV.
    MS-Off Ver
    2010
    Posts
    5

    Re: Search one column, then rows and the return adjacent cell value

    So awesome!! Thank you.
    To answer your question, the DATE cells on the DATA SHEET are not actually date cells in my real document. I am sorry. I should have picked some other less confusing heading. I replaced the headings to protect confidential data. The report I pull does not list any dates. I pull the data each month for the month prior so, I would need to either create a separate DATA SHEET for each month or I would need to put a date in somewhere on the DATA SHEET to title the data for it's respective month and have the formula look below that date or something. I hope that makes sense.

    Can you help with the best way to go about that?


    Also,
    So that I can adjust little bits of the formula as needed if, when I copy and paste the report into the DATA SHEET, things are listed a little differently than the data from last month, can you walk me through the steps?

    Here's what I see. Please correct me or help me fill in what I don't know/understand.


    =IFERROR(INDEX('DATA SHEET'!$A$1:$N$750,MATCH($A$1& " / " &$B2,'DATA SHEET'!$A$1:$A$750,0)+3,5),0)

    ** =IFERROR: <---Starts off the formula with the basis for instructions that will be listed later on in the formula about what to do if the result is an "N/A" or other error.

    ** (INDEX <---Have not used this one before. What does this do? Are you able to give me the structure/rules of a basic "INDEX" function formula?

    ** ('DATA SHEET'!$A$1:$N$750, <---Telling the formula to index the entire section of data listed on the DATA SHEET tab from the 1st cell on the top left to the last cell on the bottom right. I noticed this one has the cell references listed as non-static. How does that help in this case? Is that for the purpose of the REPORT tab so that the formula can be pasted elsewhere?)

    ** MATCH( <---Look for a match in the cells listed right before this command to the values in the cells listed after this command

    ** $A$1& " / " &$B2, <---Look at the value in cell A1, on the current sheet, along with the added specified "/" sign mixed with the value of the B2 cell on the current sheet. The cell references are listed as non-static except the Row in the B column reference. The B column is static so that it always looks in that column but the row is non-static so that it looks in the appropriate cell when the formula is pasted.

    ** 'DATA SHEET'!$A$1:$A$750, <---Look for those MATCH values on the DATA SHEET TAB in All cells between A1 and A750. Again, why are the cell references listed as non-static here?

    ** 0) <--- If a match is not found, place a zero

    ** )+3,5 <--- If a match is found, look 3 rows down, 5 cells over and return the value in that cell *-*-*- One problem with this part: In the data that I past to the DATA SHEET tab each month, the "TOTAL" that I will be looking to pull into the REPORT tab will not always be 3 rows down. Sometimes, there will be more than one dollar amount listed that will EQUAL the final total and since they will all be listed between the Region / District heading and the final total line, it could be 4 rows down, 5 rows down and so on. Hence my conundrum.

    ** ),0) <--- If a match is not found, place a zero (Seems redundant but I am assuming the 1st zero is the end to the MATCH function and the 2nd zero is the end of the "IFERROR" command.



    How'd I do?

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Search one column, then rows and the return adjacent cell value

    You will need to use a similar technique (of helper columns) to the one in the attached if the data is dynamic in the relative position of "TOTAL":


    http://www.excelforum.com/showthread...66#post4453866

    Re the date: I'll have to look at the implications of where it is placed. One option is certainly monthly sheets.

    Attached shows the addition of helper cells: note I added a blank row 1 to enable the counts to work.

    Added few blank lines to demonstrate formulae work with variable Total line
    Last edited by JohnTopley; 08-13-2016 at 01:00 PM.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,209

    Re: Search one column, then rows and the return adjacent cell value

    The attached has named sheets"Jul" and "Aug": see formula in Jul in "Report"
    Please Login or Register  to view this content.
    Last edited by JohnTopley; 08-14-2016 at 01:54 AM.

  8. #8
    Registered User
    Join Date
    08-09-2016
    Location
    Las Vegas, NV.
    MS-Off Ver
    2010
    Posts
    5

    Re: Search one column, then rows and the return adjacent cell value

    Wanted to let you know I appreciate your time in helping me with this. I have been buried and unable to review the sample files you attached but will soon and let you know how it works out. Thank you so much!

  9. #9
    Registered User
    Join Date
    08-09-2016
    Location
    Las Vegas, NV.
    MS-Off Ver
    2010
    Posts
    5

    Re: Search one column, then rows and the return adjacent cell value

    ok. I was finally able to check out what you did. I LOVE the file you attached where you added a "Jul" tab and an "Aug" tab. I will need to research exactly how the INDIRECT function works and learn how it's working in this particular instance (unless you'd be willing to explain it to me?) but I believe this will work. It will take me a while to set up my file with all the month tabs and add all the formulas but, I believe, once the work is put in, this will save a TON of time each month when I have to run these reports. Just a quick copy and paste and your fantastic formula help will do the rest of the work for me. Thank you SO much!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Search for value in row and return adjacent cell
    By lindseyd32833 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-11-2020, 04:03 PM
  2. Replies: 6
    Last Post: 04-16-2016, 11:04 AM
  3. [SOLVED] Search multiple rows for cell color, return date from same column
    By OceanAngel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-04-2014, 10:07 AM
  4. Search for value, return value in adjacent cell
    By laerm in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 2
    Last Post: 08-13-2013, 01:12 PM
  5. Replies: 2
    Last Post: 12-14-2012, 11:45 PM
  6. Replies: 1
    Last Post: 07-26-2011, 06:48 AM
  7. Search column, return values in adjacent column?
    By HELPME13 in forum Excel General
    Replies: 3
    Last Post: 10-01-2010, 11:17 AM

Tags for this Thread

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