+ Reply to Thread
Results 1 to 6 of 6

embeded if statements alternative-Selecting cell based on a range

Hybrid View

  1. #1
    Registered User
    Join Date
    01-04-2017
    Location
    SYDNEY
    MS-Off Ver
    7
    Posts
    7

    Question embeded if statements alternative-Selecting cell based on a range

    HI Guys,

    I have a burning question and hate for embedded if statements. Can someone help me with this issue:

    I have a tables as below

    Period Product
    1 A
    5 B
    15 C
    20 D

    I have periods one to 20, instead of using embedded if statements is there a simpler way to do this equation?

    I want to achieve a final result as below

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    A A A A B B B B B B B B B B C C C C C D
    Last edited by chubs; 01-05-2017 at 03:31 AM.

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: embeded if statements alternative-Selecting cell based on a range

    try:
    Formula: copy to clipboard
    =CHOOSE(MATCH(A1,{0,5,15,20,99}),"A","B","C","D")

    where A1... etc is period

  3. #3
    Registered User
    Join Date
    01-04-2017
    Location
    SYDNEY
    MS-Off Ver
    7
    Posts
    7

    Re: embeded if statements alternative-Selecting cell based on a range

    Amazing Sandy666 genius!,

    Quick question what does {0,5,15,20,99} in effect does? I notice that if i reference it to a group of cell the formula fails to work. Is there particular reason?

    Thanks for that!

  4. #4
    Registered User
    Join Date
    01-04-2017
    Location
    SYDNEY
    MS-Off Ver
    7
    Posts
    7

    Re: embeded if statements alternative-Selecting cell based on a range

    Amazing Sandy666 genius!,

    Quick question what does {0,5,15,20,99} in effect do? I notice that if i reference it to a group of cell the formula fails to work. Is there particular reason?

    Thanks for that!

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: embeded if statements alternative-Selecting cell based on a range

    I assumed your period is from positive integral set. 0,5,15,20 are initial limits. 0 is because you need values between: 0-4(A),5-14(B),15-19(C),20-over(D), 99 is because if you step over 20 from definition it will show D letter . The rest hope you know. Match() gives you number of place which will be used in CHOOSE().
    Look at MATCH() definition, espacially about match_type.
    Last edited by sandy666; 01-05-2017 at 03:31 AM.

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: embeded if statements alternative-Selecting cell based on a range

    If it resolved your problem, click on reputation star. Thanks

+ 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. Help with OFFSET, or an alternative
    By froment in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-25-2015, 03:25 PM
  2. [SOLVED] IF / OFFSET / MATCH / LOOKUP -type question
    By Jer2224 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-15-2014, 09:04 AM
  3. [SOLVED] SpeedUp/Alternative to Offset.Value = Offset.Value
    By Jovica in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-13-2013, 01:43 AM
  4. VLOOKUP(), INDEX(), OFFSET() and MATCH() Question
    By Paddon in forum Excel General
    Replies: 2
    Last Post: 11-03-2011, 01:15 PM
  5. Alternative for #N/A in an offset and match formula?
    By carlos2011 in forum Excel General
    Replies: 8
    Last Post: 03-17-2011, 07:10 AM
  6. Offset Match question
    By jrussell in forum Excel General
    Replies: 2
    Last Post: 08-07-2009, 11:41 AM
  7. QUESTION with Match command and OFFSET
    By alomega in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2005, 05:06 PM

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