# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  Switch-case by Excel?

## 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.

----------


## Bryan Hessey

> 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)))))))
> 
> ...



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
---

----------

