+ Reply to Thread
Results 1 to 2 of 2

Switch-case by Excel?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-12-2006
    Posts
    106

    Switch-case by Excel?

    Hi,

    What the easiest way to make switch-case in Excel? Is the only way to use huge bunch of ifs?

    I am using Excel 2000 and 2006, so solution to 2006 would be enough (assuming 2000 doesn't have the needed function)

    Here's an example of my current solution
    =IF(A16="Monday",Splits!AL2,IF(A16="Tuesday",Splits!AL4,IF(A16="Wednesday",Splits!AL6,IF(A16="Thursday",Splits!AL8,IF(A16="Friday",Splits!AL10,IF(A16="Saturday",Splits!AL12,Splits!AL14)))))))

    Seems pretty complicated. That is for days of week, I am planning to do it for months and also for days of month.

    Also, it is not necessary to be switch-case, anything easier would be nice.

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Jaymond Flurrie
    Hi,

    What the easiest way to make switch-case in Excel? Is the only way to use huge bunch of ifs?

    I am using Excel 2000 and 2006, so solution to 2006 would be enough (assuming 2000 doesn't have the needed function)

    Here's an example of my current solution
    =IF(A16="Monday",Splits!AL2,IF(A16="Tuesday",Splits!AL4,IF(A16="Wednesday",Splits!AL6,IF(A16="Thursday",Splits!AL8,IF(A16="Friday",Splits!AL10,IF(A16="Saturday",Splits!AL12,Splits!AL14)))))))

    Seems pretty complicated. That is for days of week, I am planning to do it for months and also for days of month.

    Also, it is not necessary to be switch-case, anything easier would be nice.
    Hi,

    =INDIRECT("Splits!"&LOOKUP(A16,{"Friday","Monday","Saturday","Sunday","Thursday","Tuesday","Wednesday"},{"AL10","AL2","AL12","AL14","AL8","AL4","AL6"}))

    CSE (CTRL/Shift/Enter for this, not just plain Enter)

    hth
    ---
    Si fractum non sit, noli id reficere.

+ 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