+ Reply to Thread
Results 1 to 6 of 6

If statement with Dynamic Range

  1. #1
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    If statement with Dynamic Range

    Hello Experts,

    Hope you could assist me with this. Please look at attached with my description.

    Situation
    I'm trying to look a value in column A (A17 to A21) and determine the dollar value after discount (desired result in column C. C17 to C21)

    Example
    cell A17, product 'h.3' is categorized hardware. Thus it'll take the price multiply by the desired discount percentage (F1),
    cell A18, product 's.1' is categorized software. Thus it'll take the price multiply by the desired discount percentage (F2),
    cell A19, product 'nd.2' is categorized as non discountable item. Thus it'll just take the price as is.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: If statement with Dynamic Range

    One way, in C17 copied down

    =LOOKUP(LEFT(A17,1),{"h","n","s"}, {0.5,1,0.25})*B17
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: If statement with Dynamic Range

    That works...but since this is just a sample, so i "cheated" a little, in a sense that whenever it's a hardware, it started with a letter 'h' and the same with software or non discount categories.

    Assuming that if i have a lists where I determine it's category (either through the headers or besides them on every list), would there be a way to know?

    That's why I have a name range on it.

    Initially, what i had in mind was a IF and look if it's in the range of the dynamic range. i.e =IF(C17 is in the hardware category range, B17*(1-F1) ... etc)

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: If statement with Dynamic Range

    This should work

    =IF(ISNUMBER(MATCH(A17, $A$2:$A$14,0)),B17*0.5, IF(ISNUMBER(MATCH(A17,$B$2:$B$14,0)), B17*0.25, B17))

  5. #5
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,067

    Re: If statement with Dynamic Range

    It works. Thanks ChemistB. Didn't know have to use the match formula. I thought a simple IF statement would work with the curly brackets.

    =if(A17={hardware range}, ..., ...)

    Anyway, reps up to you. Please check.

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: If statement with Dynamic Range

    Thanks dluhut. Glad it's working.

+ 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