Result depending upon listbox

jimpatel1993
2StarLounger
Posts: 153
Joined: 31 Jan 2021, 09:12

Result depending upon listbox

Post by jimpatel1993 »

Thanks again for looking at my post.
I got stuck with two different scenario and any help will be appreciated.
Issue 1: I have userform with "Name", "Select Date" and text box where i am expecting answer.
Scenario is when the user select one or more name and corresponding Select date, i would like to get answer in the text box please.
Example 1: When user select "William" in the listbox and "2days" from the combo box and the result will be "3"
Example 2: When user select "William" and "Lora" and "3days" from the combo box and the result will be 56+4 which will be 60

Issue 2: Additionally i have another list box which is not shown in the example userform. Is there any way to bring result in the text box for all the items in the listbox irrespective of selection depending upon select Date option please?
Thanks a lot again
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Result depending upon listbox

Post by HansV »

See the attached version. If you leave the date combo box empty, all values for the selected names will be added,
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

jimpatel1993
2StarLounger
Posts: 153
Joined: 31 Jan 2021, 09:12

Re: Result depending upon listbox

Post by jimpatel1993 »

That's brilliant thanks a lot for your time and effort.
Really appreciated
Thanks

jimpatel1993
2StarLounger
Posts: 153
Joined: 31 Jan 2021, 09:12

Re: Result depending upon listbox

Post by jimpatel1993 »

Just one more question. Sorry to annoy you.
I have multiple list boxes and list box order won't be same as sheet 2 ordering.
That is if I select Sara in the list box, Sara might be second name in the list box but in sheet 2 it is in row 6 which means I am pulling wrong data. Is there any way to search what list box name is clicked in the sheet 2 to get corresponding information pls?
Thanks again and sorry about this

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Result depending upon listbox

Post by HansV »

The attached version searches for the selected names instead of relying on the order.

Result depending upon listbox selection.xlsm
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

jimpatel1993
2StarLounger
Posts: 153
Joined: 31 Jan 2021, 09:12

Re: Result depending upon listbox

Post by jimpatel1993 »

That's brilliant. Thanks a lot for your idea.
When I implement in my excel the list box have already data and there input is coming from different code. So when I click list box 1 I just need to search from sheet2 the corresponding name and data. For that do I need to delete any line in your code as the row source is already mentioned in different code.
Thanks again

User avatar
HansV
Administrator
Posts: 78237
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Result depending upon listbox

Post by HansV »

Sorry, I don't understand.
Best wishes,
Hans

jimpatel1993
2StarLounger
Posts: 153
Joined: 31 Jan 2021, 09:12

Re: Result depending upon listbox

Post by jimpatel1993 »

Sorry my bad
All good
Thanks a lot again