using switch with formulas in the target cells

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello all,

When I use SWITCH, and the values are formulas I don't get any result, when the values are just values i do. is there an alternative?

Here's a shortened example:
Code:
=SWITCH(D15,KDS!L9,KDS!N9,KDS!M10,KDS!N10,KDS!M11,KDS!N11,"-")

KDS!L9:
Code:
=M10-TIME(0,1,0)
the value is 3:33
if I type that in directly, it works. If I leave the formula in that and the adjacent cells, I don't get anything other than "-" as my result.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I am not a pro, and I have never used SWITCH(). But could you use .VALUE in your code to pull the value of the Cell, rather than the formula?

...range("d15").value,....
 
Last edited:
Upvote 0
What's the value/formula in D15?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top