+ Reply to Thread
Results 1 to 12 of 12

Match by using several criterias plus offset?

  1. #1
    Registered User
    Join Date
    06-06-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    6

    Match by using several criterias plus offset?

    Hello,

    Please look at the following picture which is a basic layout of what Im after:

    http://img.ihack.se/one/4239Excel.JPG

    I want to enter city plus date and then I want a function that derives the price. I am thinking some kind of offset function where it first looks at the city to "lock a row" and then look for between what cells the date fits and then offsets one to the right? Maybe I am way off here, I really need some advise!

    All help is appreciated!

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Match by using several criterias plus offset?

    It would be very helpful if you post some sample data and what values you want to see returned.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    06-06-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    6

    Smile Re: Match by using several criterias plus offset?

    Quote Originally Posted by Ron Coderre View Post
    It would be very helpful if you post some sample data and what values you want to see returned.
    How do you mean? They are in the picture. I cant make any tables here. Basically in the picture the last column to the right is derived from D2 (New York, with a date between A2 and A3). I hope I get my point across

  4. #4
    Registered User
    Join Date
    06-06-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Match by using several criterias plus offset?

    Using an IF command, is it possible to start a new if command if the first one returns false? Like this:

    100-120 cm: Dwarf
    160-170 cm: Average Women
    170-185 cm: Average man

    Basically if I have a value, let's say 174 cm is it possible to do something like this:

    If value is between 100-120 return dwarf, if not look if its in average women, if not look if its in average man?

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Match by using several criterias plus offset?

    I understand what you're trying to do...I missed it the first time looked.

    With
    A2: a city...eg New York
    B2: a date...eg 2010-05-24

    and the price schedule in this format in cells E1:H5
    Please Login or Register  to view this content.
    This formula returns the price associated with the city and the date:
    Please Login or Register  to view this content.
    In the above example, the formula returns: $1,500

    Is that something you can work with?

  6. #6
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Match by using several criterias plus offset?

    I take look at this
    Using table in picture
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  7. #7
    Registered User
    Join Date
    06-06-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Match by using several criterias plus offset?

    Quote Originally Posted by contaminated View Post
    I take look at this
    Using table in picture
    Quote Originally Posted by Ron Coderre View Post
    I understand what you're trying to do...I missed it the first time looked.

    With
    A2: a city...eg New York
    B2: a date...eg 2010-05-24

    and the price schedule in this format in cells E1:H5
    Please Login or Register  to view this content.
    This formula returns the price associated with the city and the date:
    Please Login or Register  to view this content.
    In the above example, the formula returns: $1,500

    Is that something you can work with?
    Unfortunally I can not since the cities will be in different datespans. And I can't use , in code have to use ;

    That's off-topic but anyone know why? Maybe because I have swedish version of excel?

  8. #8
    Registered User
    Join Date
    06-06-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    6

    Wink Re: Match by using several criterias plus offset?

    Quote Originally Posted by contaminated View Post
    I take look at this
    Using table in picture
    Wow, exactly what I needed... I am not even gonna ask what's inside that formula

    Only problem is that it works in Excel 2010 beta (because it is in english) but not in my excel 2003 since its swedish. Is there any add-on or function where I can copy a formula in english and it automatically translate it to work with swedish?

  9. #9
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Match by using several criterias plus offset?

    It had to be translated automatically
    BTW I fount an error in formula
    Please Login or Register  to view this content.

  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Match by using several criterias plus offset?

    That formula doesn't work for me - if I input a date in the 2nd date range the answer is a date....and if I enter a date which isn't in any of the date ranges I get a result....surely that should be an error?

    As Ron implies, the layout makes this much more complex that it needs to be, will you only have 3 date ranges or is that just an example? In your example there are no gaps in the ranges, will that always be the case?
    Audere est facere

  11. #11
    Registered User
    Join Date
    06-06-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Match by using several criterias plus offset?

    Quote Originally Posted by daddylonglegs View Post
    That formula doesn't work for me - if I input a date in the 2nd date range the answer is a date....and if I enter a date which isn't in any of the date ranges I get a result....surely that should be an error?

    As Ron implies, the layout makes this much more complex that it needs to be, will you only have 3 date ranges or is that just an example? In your example there are no gaps in the ranges, will that always be the case?
    There will be gaps in ranges which is the major problem that makes this so frustrating

    Im still wondering if I can make an "IF" statement which goes on to a new function when it returns false? Look at my example with the cm in some posts above...

  12. #12
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Match by using several criterias plus offset?

    If you can add a header row with "To", "From" etc. (see attached) then you can use this formula

    =SUMPRODUCT((INDEX(B5:J8,MATCH(A2,A5:A8,0),0)<=B2)*(INDEX(C5:K8,MATCH(A2,A5:A8,0), 0)>=B2)*(B4:J4="To")*(C4:K4="From"),INDEX(D5:L8,MATCH(A2,A5:A8,0),0))

    If the date isn't within one of the ranges listed for that location you'll get zero
    Attached Files Attached Files
    Last edited by daddylonglegs; 06-06-2010 at 06:10 PM.

+ 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