What Data Type do you use for Boolean plus one. True, False and TBD

USAMax

Well-known Member
Joined
May 31, 2006
Messages
846
Office Version
  1. 365
Platform
  1. Windows
I have a complicated routine that I am writing that would normally be Boolean but there are a few times when the answer will be To Be Determined. There are some that are clearly defined with a lot of IF THEN ELSE statements but when all is said and done, there will be three answers.

There are a lot of ways to handle this and I would like to use a IF ROUTINE(VARIABLES) THEN statement in my code but with the third option I cannot.

I am not asking how to write the code, I want to know you found it best to return the answer.

What it the way you found to handle this True, False, Maybe problem?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You could use the VbTriState constants (vbTrue, vbFalse, vbUseDefault)
 
Upvote 0
Or create an enum for true, false and to be determined. N.B This is the same as shg's suggestion, but is a little more flexible since it would allow you to add additional statuses if required
 
Upvote 0
I like Kyle's suggestion better.

You could do the whole Magic Eight Ball enumeration of answers.
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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