+ Reply to Thread
Results 1 to 9 of 9

Formula to look up various rows of a particular code

  1. #1
    Registered User
    Join Date
    03-27-2017
    Location
    malta
    MS-Off Ver
    2013
    Posts
    4

    Formula to look up various rows of a particular code

    I need a formula to solve my problem below:

    I have a spreadsheet (Sheet A) with a report for which column A has different nominal codes.
    In a separate sheets, for example Sheet B i need to create a formula whereby it looks up a particular nominal code (Eg. 6270) from sheet A and all the row adjacent to it. There would be multiple rows.
    In another sheet C, same formula which looks up another nominal code (e.g 6280). ETc Etc

    An attachment is also upload to view my problem

    Thank you so much
    Attached Files Attached Files

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

    Re: Formula to look up various rows of a particular code

    use this array formula in A6, copied across and down:

    =IFERROR(INDEX('Sheet A (downloaded report)'!B:B,SMALL(IF(--LEFT('Sheet A (downloaded report)'!$B$2:$B$7,4)=6270,ROW('Sheet A (downloaded report)'!$B$2:$B$7)),ROWS(A$6:A6))),"")

    You'll need to change the references iin the INDEX bit to account for the hidden columns (see my formula in your sheet)

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    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
    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

  3. #3
    Registered User
    Join Date
    03-27-2017
    Location
    malta
    MS-Off Ver
    2013
    Posts
    4

    Re: Formula to look up various rows of a particular code

    Woow thank you so much for your fast reply.

    I am trying to drag down the formula below (for more rows). Is this where you say you need to press cntrl-shift-enter ? Since nothing is happening and is getting blank cells.

  4. #4
    Registered User
    Join Date
    03-27-2017
    Location
    malta
    MS-Off Ver
    2013
    Posts
    4

    Re: Formula to look up various rows of a particular code

    File updated and complicated it a bit further, since the downloaded report would be constantly updated. However, something is not quite good. Both sheets are only getting part of the info. And I am finding difficult to drag the formula to the rows below.

    thanks for your help
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: Formula to look up various rows of a particular code

    After typing a formula generally we press enter. But if it is an array formula then we need to press Ctrl + Shift + Enter after typing the formula. Hope you will get this now.

  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 2403
    Posts
    44,127

    Re: Formula to look up various rows of a particular code

    Im away for about half an hour....

  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 2403
    Posts
    44,127

    Re: Formula to look up various rows of a particular code

    That is because you did not change the ranges that the formulae were looking at. To remove the need to do that, I have set up a Named range (called nominal, hit CTRL F3 to see the formula in use there), that will adjust the range automatically as new rows area added (currently to a maximum of 1000).

    I have no idea what should go into the yellow cells in sheet C as the headings don't exist in sheet A.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    03-27-2017
    Location
    malta
    MS-Off Ver
    2013
    Posts
    4

    Re: Formula to look up various rows of a particular code

    Thank you so much xx
    it's perfect!!!

    A million thanks once again!
    Last edited by cuty; 03-28-2017 at 03:02 AM.

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

    Re: Formula to look up various rows of a particular code

    You're welcome and Thanks for the Rep!!

+ 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. VBA code to Insert simple formula into dynamic blank rows
    By Kickin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-20-2014, 10:10 PM
  2. Code to continue formula in column when adding rows
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2014, 09:39 PM
  3. Need of formula for getting job code to appear in column A of total rows.
    By corwinjk in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-10-2014, 01:00 PM
  4. [SOLVED] VBA Code: copy relative array formula into X rows
    By haven83 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-30-2012, 01:46 AM
  5. Vb code or Excel formula Help for unique rows
    By sem in forum Excel General
    Replies: 44
    Last Post: 06-02-2011, 11:43 AM
  6. Replies: 1
    Last Post: 06-20-2009, 03:43 PM

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