Choose2

Returns a value based on an ID.
If ID is 1, return 1st value, If ID is 2, returns 2nd
Choose3 will pick from 3, Choose4 from 4, will have a value to be return if ID was not within expected values.
If you used the Excel function CHOOSE(), you will like this.
This one is simpler and does not use array. That is why we have multiple versions.
I created this to use instead of using "Select Case ... End Select" after getting spoiled with IIF()

Edit 2024-09-03: Adding optional to all REturn values, fixing some other small bug found

CodeFunctionName What is this?

Public

Tested

Original Work

Access is limited.

Login here using your Linkedin account. to see or download code.

No registration, not another password to remember, login using your Linkedin account and have access to all public codes in Bold.codes

Linkedin Login

ChooseID, Optional ReturnIf1 = "", Optional ReturnIf2 = "", Optional ReturnIfNone = ""
ChooseID, Optional ReturnIf1 = "", Optional ReturnIf2 = "", Optional ReturnIf3 = "", Optional ReturnIfNone = ""
ChooseID, Optional ReturnIf1 = "", Optional ReturnIf2 = "", Optional ReturnIf3 = "", Optional ReturnIf4 = "", Optional ReturnIfNone = ""

Views 14

Downloads 5

CodeID
DB ID

ANmarAmdeen
701
Attachments
Revisions

v2.0

Tuesday
September
3
2024