+ Reply to Thread
Results 1 to 6 of 6

having trouble with if functions

  1. #1
    Registered User
    Join Date
    09-20-2013
    Location
    ontario
    MS-Off Ver
    Excel 2007
    Posts
    14

    having trouble with if functions

    recordsheet.forum.xlsm


    Hello, I am new but i have been racking my brain about this if function for a while. I am attempting to create a nested if function that returns a value from a database worksheet based on the name of a person entered.

    =IF(ROWS(A$3:A4)>$F$1,"",INDEX(DataBase!$A$2:$A$1048576, SMALL(IF(DataBase!$B$2:$B$1048576=Athletname,ROW(DataBase!$B$2:$B$1048576)-1),ROWS(A$3:A4))))


    this is the function that i am using.
    so it states if the row count is greater than the number of data sets put nothing. otherwise index "database is the sheet name" if the database cell = the athlete name. type smallest value from the database.

    now my problem is it works on the first line of my spreadsheet but when i copy it down i get #num error

    but if i highlight the portions individually and hit F9 to calculate them out it will give me the right value.

    I bolded all the worksheet names and name ranges.

    my question was probably confusing so i posted a copy of my file hopefully that makes it easier.
    Last edited by dsm63; 09-20-2013 at 03:10 PM.

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: having trouble with if functions

    You forgot to hit Ctrl + Shift + Enter.
    This is how I would do it. Using Excel Table adapts the ranges so that formulas don't have to recalc 1 million, only the ranges that contain data.
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  3. #3
    Registered User
    Join Date
    09-20-2013
    Location
    ontario
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: having trouble with if functions

    thats amazing!! im going to work with this tonight but i think you just solved my problem..

    why did the {} appear around the formula?

  4. #4
    Registered User
    Join Date
    09-20-2013
    Location
    ontario
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: having trouble with if functions

    can i ask another question? if i wanted to take what you have done Jacc and than have it index the rest of the data what would that function look like? in your table format?

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: having trouble with if functions

    The Ctrl + Shift + Enter converts the formula to an array formula. The brackets are an indicator that it has been converted to an array formula. Adding the bracket symbols alone have no effect.

    Basically an array formula allows the functions within to accept a range as an argument instead of just a single cell.

    Select one cell with a formula in, goto the Formulas banner and click Evaluate Formula (middle right). Do that with an array formula and you see there is a lot going on.

    http://office.microsoft.com/en-us/ex...001087290.aspx
    http://www.cpearson.com/excel/arrayformulas.aspx
    http://spreadsheets.about.com/od/exc...s-tutorial.htm

    I'll look at the formula tomorrow.

  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: having trouble with if functions

    I didn't look at your file.

    How many rows of data do you have?

    You should avoid referencing the entire columns (less one row) in this portion of the formula:

    =IF(ROWS(A$3:A4)>$F$1,"",INDEX(DataBase!$A$2:$A$1048576,SMALL(IF(DataBase!$B$2:$B$1048576=Athletname,ROW(DataBase!$B$2:$B$1048576)-1),ROWS(A$3:A4))))

    Use smaller specific ranges.

    Let's assume your data goes down to row 1000.

    Try it like this...

    Array entered**:

    =IF(ROWS(A$3:A4)>$F$1,"",INDEX(DataBase!$A:$A,SMALL(IF(DataBase!$B$2:$B$1000=Athletname,ROW(DataBase!$B$2:$B$1000)),ROWS(A$3:A3))))


    ** 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.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Having trouble with complex ROUNDING functions.
    By kendrijami in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-19-2010, 04:20 AM
  2. Trouble Combining Functions
    By jturenne in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-06-2009, 01:35 PM
  3. Trouble with CODE/IF functions
    By Darknessfalls in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-26-2008, 01:28 PM
  4. HELP!!! Trouble with IF, AND functions
    By Ally1977 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-13-2006, 04:00 AM
  5. date functions:trouble
    By VDan in forum Excel General
    Replies: 1
    Last Post: 08-31-2005, 01:24 PM

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