+ Reply to Thread
Results 1 to 15 of 15

Thread: if, and to extact item from table or not. {SOLVED}

  1. #1
    Forum Contributor
    Join Date
    06-27-2009
    Location
    montana,USA
    MS-Off Ver
    Excel 2007
    Posts
    146

    if, and to extact item from table or not. {SOLVED}

    Can someone please help me.
    I need a formula for cell D2 that will return the mileage value from sheet 1 by comparing it to the information from sheet 1.
    ie. if (location = bobs) + (term = HLN) miles = 167
    heres the catch,
    If (truck=cc) miles=0
    Attached Files Attached Files
    Last edited by simpson; 11-18-2011 at 03:28 PM.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: if, and

    Try:

    =IF(B2="cc",0,INDEX(Sheet1!$B$4:$D$7,MATCH(A2,Sheet1!$A$4:$A$7,0),MATCH(C2,Sheet1!$B$3:$D$3,0)))

    copied down
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Forum Contributor
    Join Date
    06-27-2009
    Location
    montana,USA
    MS-Off Ver
    Excel 2007
    Posts
    146

    Re: if, and

    that works! you are awsome.
    thanks again!

  4. #4
    Forum Guru Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    5,589

    Re: if, and

    FWIW
    Once again I charged down the dynamic names route and arrived late!
    I'll post it anyhow as it's done.

    This table can be expanded with as many rows and columns as you need.
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However, if this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody! ....
    Also
    If you are satisfied by any members response to your problem please consider using the small Star icon botom left of thier post to show your appreciation.

  5. #5
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: if, and

    Does every question require dynamic range solutions?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  6. #6
    Forum Guru Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    5,589

    Re: if, and

    @ NBVC
    Not really, but several posts recently have been about this type of question.
    The actual worksheets have ended up many times larger than the original sample.
    The solutions end up with volatile dynamic ranges.
    Then the OP complains the worksheets is painfully slow.

    Guess I've just got a bee in my bunnet!

  7. #7
    Forum Guru Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    Excel 2010
    Posts
    1,249

    Re: if, and

    I am with you Marcol. Dynamic Ranges are a quick and easy way to optimize your workbook. Especially if the person who will ultimately be in charge of using or maintaining the file is not an Excel expert. The speed difference between a dynamic range and just referencing a large range like A1:A100000 isn't all that much, and not usually noticiable, but it prevents the need to maintain it in the far future when you've forgotten how the workbook is organized. And the self documenting bonus of naming your range is a huge plus.

    Plus I just like the coolness of the INDEX approach for dynamic ranges.

  8. #8
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: if, and

    I agree but it isn't always necessary, not all spreadsheets are going to use ranges into the 1000's of rows....
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  9. #9
    Forum Contributor
    Join Date
    06-27-2009
    Location
    montana,USA
    MS-Off Ver
    Excel 2007
    Posts
    146

    Re: if, and

    If this helps.....
    the worksheet i will be applying the formula to is very different then the sample. It will still take some time to imput the formula and make it work.
    The solution worked in my sample great, but when I transfered it to the actual sheet and modified it I am coming up with the location name from column A instead of the mileage from column D.
    I'll keep plugging away though.
    I'de like to show you guys the actual workbook sometime. I've been told it is quite impressive. but it is slow to open. It really should be an access database but i'm running into a wall getting started on that progess.
    thanks to all!

  10. #10
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: if, and

    Here is a good website that teaches you the Index/Match combination:

    http://www.contextures.com/xlfunctions03.html

    It also shows you how to create dynamic named ranges, if you need them:

    http://www.contextures.com/xlnames01.html#Dynamic
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  11. #11
    Forum Contributor
    Join Date
    06-27-2009
    Location
    montana,USA
    MS-Off Ver
    Excel 2007
    Posts
    146

    Re: if, and to extact item from table or not.

    here is a better sample of the actual. If your interested.
    Attached Files Attached Files

  12. #12
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: if, and to extact item from table or not.

    Try:

    =IF(C2="cc",0,INDEX(Sheet1!$B$4:$F$14,MATCH(A3,Sheet1!$A$4:$A$14,0),MATCH(Q3,Sheet1!$B$3:$F$3,0)))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  13. #13
    Forum Guru Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    5,589

    Re: if, and to extact item from table or not.

    @ Whizbang, forget the "Coolness"
    Plus I just like the coolness of the INDEX approach for dynamic ranges
    The fact that INDEX(MATCH()) isn't volatile makes a large workbook very workable when volatile functions like OFFSET() grind to a halt.

    The penalty to pay is that the workbook is slower to open because INDEX(MATCH()) is "quasi-volatile" at this stage only, but what's that compared to a sheet that opens in a flash then dies when you enter anything?

  14. #14
    Forum Contributor
    Join Date
    06-27-2009
    Location
    montana,USA
    MS-Off Ver
    Excel 2007
    Posts
    146

    Re: if, and to extact item from table or not.

    Thats crazy!
    You must be able to figure that out faster then I can even type the question.

  15. #15
    Forum Guru Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    5,589

    Re: if, and to extact item from table or not.

    For the record only, here it is with your data applied.

    Add to Sheet1 ColumnA as required, add more Columns for "Terms"
    Select from the dropdowns in Sheet" Columns A and Q
    Attached Files Attached Files
    If you need any more information, please feel free to ask.

    However, if this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody! ....
    Also
    If you are satisfied by any members response to your problem please consider using the small Star icon botom left of thier post to show your appreciation.

+ 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.2.0