+ Reply to Thread
Results 1 to 15 of 15

Urgent Please Help! Look up a value and return multiple instances and data relating to it

  1. #1
    Registered User
    Join Date
    01-20-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Urgent Please Help! Look up a value and return multiple instances and data relating to it

    I know this has probably already been discussed but I cant seem to find the post (and am running out of time on a project). I am creating a formula to look up a name in column A and return dates relating to that name from Column B. Here's the formula I am using. It works in the first instance but when I autofill, it comes up as #NUM. What am I doing wrong?

    =INDEX($A$1:$B$7,SMALL(IF($A$1:$A$7=$A$10,ROW($A$1:$A$7)),ROW(1:1)),2)

    I have tried copying and pasting as well as dragging the formula down.
    Last edited by OzBizConcierge; 01-22-2013 at 10:13 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,051

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    Try entering it with CTRL SHIFT ENTER and not just enter - it is an array formula
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    I believe that is a Array formula, so instead of entering with Enter, you have to hold Cntrl + Shift + Enter, it will be entered right when you see { at start and } at the end of the formula, then copy it down
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    Try it like this...

    Let's assume you want the results starting in cell D2 downwards.

    Array entered** in D2:

    =INDEX($B:$B,SMALL(IF($A$1:$A$7=$A$10,ROW($A$1:$A$7)),ROWS(D$2:D2)))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.


    Copy down as needed.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    01-20-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    Thank you for getting back to me so quickly. I have tried that and its allowing me to fill but now its returning the wrong values. Any chance any of you kind poeple could have a look at my spreadsheet and tell me what I am doing wrong?
    Attached Files Attached Files

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    In your file the data on the Main sheet is sorted/grouped together by name.

    So, you can use a more efficient formula.

    Enter this formula on the Invoice sheet in cell B1. This will return the count of records for the name in cell A1.

    =COUNTIF(Main!A:A,A1)

    Enter this formula in A4:

    =IF(ROWS(A$4:A4)>B$1,"",INDEX(Main!B$4:B$17,MATCH(A$1,Main!A$4:A$17,0)+ROWS(A$4:A4)-1))

    Copy down until you get blanks.

  7. #7
    Registered User
    Join Date
    01-20-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    Thank You, Thank You Tony Valko!!!! That Worked perfectly!!!! Now to work out how to fill the rest of the info in!

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    If you want all the info returned...

    Entered in B4:

    =IF(ROWS(A$4:A4)>$B$1,"",INDEX(Main!B$4:B$17,MATCH($A$1,Main!$A$4:$A$17,0)+ROWS(A$4:A4)-1))

    Copy across to F4.

    You'll have to format the cells B4, D4:F4 in a number format of your choice.

    Once you have the formats set select the range A4:F4 and copy down until you get blanks.

  9. #9
    Registered User
    Join Date
    01-20-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    Perfect, MVP no doubt!!!! Thanks again

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    You're welcome. Thanks for the feedback!

  11. #11
    Registered User
    Join Date
    01-20-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    Just in relation to my issue above, I am having problems with the formula because to get the source data into 'Main', I have to copy and paste info from somewhere else,then cut and paste some columns to only leave the ones on the "main" page. This seems to confuse the formula and I only get results in column A but #REF in the other columns...Any ideas why?

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    I'd have to see a before and after file to see what's happening.

  13. #13
    Registered User
    Join Date
    01-20-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    Please find attached a cross section of the actual spreadsheet and a procedure doc. Aim is to find a faster/shorter way of processing the info into the invoice sheets. Much appreciated
    Attached Files Attached Files

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    I can't open *.docx files.

    Maybe someone else can help.

  15. #15
    Registered User
    Join Date
    01-20-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Urgent Please Help! Look up a value and return multiple instances and data relating to

    That's alright..Thanks anyway.

    Just incase here it is in .doc
    Attached Files Attached Files

+ 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