+ Reply to Thread
Results 1 to 8 of 8

formula to find a number in a range then use the data in same column but row 16

  1. #1
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    648

    formula to find a number in a range then use the data in same column but row 16

    I have a sheet that in a cell I want to search a range (O19:W27) and if it finds an exact match to the data in (F7) EX:"SDM-0011" ---data will have numbers and letters and will change. If it finds that exact match in the specified range it grabs the number in the same column above it on row 16.

    Sometimes the same match will be found in the specified range more than once so I would like the number grouped together separated by comma.
    Ex: if found in 2 spots and the number in row 16 are 2 & 3 then it would return "2,3" in cell (E11)

    I use this formula on other parts of the sheet

    =IF(F7="","",SUMPRODUCT(($O$19:$W$27=F7)*IF(ISNUMBER($O$7:$W$7),$O$7:$W$7)))

    an array that adds the numbers together that match what it was looking for but instead of adding the data together I want it to display it as it is.

    Right now it returns "5"
    what I want is "2,3"

    I know its doing it because of the "sumproduct" but can I use something else to give me the result I want
    Last edited by bdouglas1011; 01-16-2019 at 03:39 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,642

    Re: formula to find a number in a range then use the data in same column but row 16

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    648

    Re: formula to find a number in a range then use the data in same column but row 16

    data I am searching for is in "F7" = SDM-0011
    Range to check "O19:W27"
    when it finds a match ....return the value in ROW 7 above the match in the same column and place it in E11

    Search for another match in the range and group the data separated by commas


    See on the Before Page cell E11 is blank
    See on After Page it has "2,3"
    Attached Files Attached Files
    Last edited by bdouglas1011; 01-16-2019 at 04:52 AM.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: formula to find a number in a range then use the data in same column but row 16

    One way..
    Please Login or Register  to view this content.
    How to install your new code
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Press Alt+F11 to open the Visual Basic Editor
    Choose Insert > Module
    Edit > Paste the macro into the module that appeared
    Close the VBEditor
    Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)


    Then an array formula in E11:

    =ConcatAll(IF($O$19:$W$27=$F$7,$O$7:$W$7,""),", ")


    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 01-16-2019 at 05:40 AM.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    648

    Re: formula to find a number in a range then use the data in same column but row 16

    I have a question if you don't mind. I had another post trying to get this same result an easier way but really have not had any response.

    The 3 data sheets that I import into this sheet work OK this way because I export them out of 3 workbooks which changes them into an .XLSX
    then I can just do three separate imports and place the data the way you see to get this result using these formulas.

    What I would love is to be able and have some code that when run it would ask you what file you would like for sources (different workbooks) and then it would compile this same information and get the same result just easier and quicker.

    The problem I ran into is the original workbooks are .XLSM and when anything starts to run it stops and nothing happens.

    Then I thought maybe it could take the file and open it then convert the sheet into .XLSX in the code and then in turn use that info to give the same result.

    I have code that within each workbook exports the file ok...but when I try to have a dialogue box ask you for your source file once it opens the code does not run.

    Any thoughts...

    Essentially I usually have about 3 different workbooks that I would love be able to either link to the master inventory to track hours or have code to run the 3 sheets on to get this data.

    It is hard to explain do you think it could be done?

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: formula to find a number in a range then use the data in same column but row 16

    The wee bit of code that I posted is pretty much all that I can do with VBA. I use VBA like a drunk man uses a lampost... for support, not illumination.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: formula to find a number in a range then use the data in same column but row 16

    I have just looked at your other thread.... I didn't understand a bit of it!!!!

  8. #8
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    648

    Re: formula to find a number in a range then use the data in same column but row 16

    Thanks now that i Have this working I might end that thread and try to re explain it better.

    Thanks for your help

+ 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. [SOLVED] Find number in range and return the value in another column
    By HangMan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-10-2017, 01:36 PM
  2. [SOLVED] Find column number from specific range
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2016, 09:12 AM
  3. Find row & column number of cells in a range with lookup functions
    By ieumts in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-02-2014, 03:01 AM
  4. Find column number or range in a row (multiple ranges)
    By Martijn79 in forum Excel General
    Replies: 15
    Last Post: 04-13-2014, 06:29 AM
  5. [SOLVED] Find and Get Column Letter and Row Number from Duplicates in Range of Cells
    By WITJ in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2013, 12:23 PM
  6. How to find a cell from a range and identify its column number
    By JamesGoulding85 in forum Excel General
    Replies: 2
    Last Post: 06-06-2013, 08:29 AM
  7. [SOLVED] find bold number in Column A and copy range to column C
    By joek13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-24-2012, 10:32 AM

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