A question with two parts .. please check attachment sir

Kichan

Board Regular
Joined
Feb 21, 2022
Messages
63
Office Version
  1. 2010
Platform
  1. Windows
I got a question that
A-1,2,B-3,6 and the answer should be
A-1,A-2,B-3,B-6
The requirment is "A-" should be constant in first part and "B-" is constant in second part .. Can we do this kind of questions in Excel ie.. a question having a question with two parts
 

Attachments

  • Screenshot_2022-03-08-23-35-53-99_87869c5c71fa0655e350912352595c23.jpg
    Screenshot_2022-03-08-23-35-53-99_87869c5c71fa0655e350912352595c23.jpg
    84.5 KB · Views: 9

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Thank u for your replay sir..
Can u please check the attachment sir...your formula is only working with two digits after "A-" there will be more items after that "-" .. how can we do it in that kind of situation .. showed in the attachment picture
 

Attachments

  • Screenshot_2022-03-09-08-44-49-74_87869c5c71fa0655e350912352595c23.jpg
    Screenshot_2022-03-09-08-44-49-74_87869c5c71fa0655e350912352595c23.jpg
    93.2 KB · Views: 4
Upvote 0
Thank u for your replay sir..
Can u please check the attachment sir...your formula is only working with two digits after "A-" there will be more items after that "-" .. how can we do it in that kind of situation .. showed in the attachment picture

That's because your data is Different than what you posted in your OP sample, as in some of your other question threads. It's Always best to post Actual samples representative of your data, so helpers don't need to waste time modifying formulas as you trickle in the information.

Also, please post sample data using XL2BB (see my signature), or at least in Table format, so helpers don't need to manually type your data for testing, TIA.

I'll look into it later.
 
Upvote 0
Ok sir .. I wil send u sample data through XL2BB .. thank u
 
Upvote 0
Book1.xlsx
AB
11-1,2,3,5-8,9,10 1-1,1-2,1-3,5-8,5-9,5-10
2B-5,6,7,12-1,2,3,100-1,2,3B-5,B-6,B-7,12-1,12-2,12-3,100-1,100-2,100-3
315-1,2,3,8,4,5,615-1,15-2,15-3,15-8,15-4,15-5,15-6
41854-1,2,3,1525-1,2,3,41854-1,1854-2,1854-3,1525-1,1525-2,1525-3,1525-4
Sheet1
 
Last edited:
Upvote 0
B-5,6,7,12-1,2,3,100-1,2,3B-5,B-6,B-7,12-1,12-2,12-3,100-1,100-2,100-3
in this case "B-5" is constant for 5,6,7 and "12-" is constant for 1,2,3 and "100-" is constant for 1,2,3
please see the attached thread attached below
Book1.xlsx
AB
11-1,2,3,5-8,9,10 1-1,1-2,1-3,5-8,5-9,5-10
2B-5,6,7,12-1,2,3,100-1,2,3B-5,B-6,B-7,12-1,12-2,12-3,100-1,100-2,100-3
315-1,2,3,8,4,5,615-1,15-2,15-3,15-8,15-4,15-5,15-6
41854-1,2,3,1525-1,2,3,41854-1,1854-2,1854-3,1525-1,1525-2,1525-3,1525-4
Sheet1
 
Upvote 0
I was trying to supply a single formula to solve your query, but after literally hours of trying, and due to the total inconsistency of your source text strings, I realized I was going down a rabbit hole.
So, I decided helper columns are needed, and more hours of trying, even with that, it's messy, but this works, Based only on your most recent data, hopefully it'll work for you.

You can Hide the "Helper Columns" if you'd like:

Cell Formulas
RangeFormula
B2:B13B2=TRIM(LEFT(SUBSTITUTE(A2,",",IF(ISNUMBER(FIND("-",A2,FIND("-",A2)+1)),REPT(" ",100),","),LEN(LEFT(A2,FIND("-",A2&"-",FIND("-",A2)+1)))-LEN(SUBSTITUTE(LEFT(A2,FIND("-",A2&"-",FIND("-",A2)+1)),",",""))),100))
C2:C13C2=SUBSTITUTE(A2,TRIM(LEFT(SUBSTITUTE(A2,",",IF(ISNUMBER(FIND("-",A2,FIND("-",A2)+1)),REPT(" ",100),","),LEN(LEFT(A2,FIND("-",A2&"-",FIND("-",A2)+1)))-LEN(SUBSTITUTE(LEFT(A2,FIND("-",A2&"-",FIND("-",A2)+1)),",",""))),100))&",","")
D2:D13D2=SUBSTITUTE(TRIM(LEFT(SUBSTITUTE(C2,",",IF(ISNUMBER(FIND("-",C2,FIND("-",C2)+1)),REPT(" ",100),","),LEN(LEFT(C2,FIND("-",C2&"-",FIND("-",C2)+1)))-LEN(SUBSTITUTE(LEFT(C2,FIND("-",C2&"-",FIND("-",C2)+1)),",",""))),100)),B2,"")
E2:E13E2=IF(D2="","",MID(SUBSTITUTE(SUBSTITUTE(A2,B2&",",""),D2,""),2,99))
F2:F13F2=SUBSTITUTE(TRIM(SUBSTITUTE(B2,",",","&LEFT(B2,FIND("-",B2)))&" "&IFERROR(SUBSTITUTE(D2,",",","&LEFT(D2,FIND("-",D2))),"")&IFERROR(" "&SUBSTITUTE(E2,",",","&LEFT(E2,FIND("-",E2))),""))," ",",")
 
Upvote 0
You are a life saver sir .. this as literally for my girlfriend ..
Thank you very much ... Have a nice day.. :)
 
Upvote 0
You're welcome, don't forget to mark solution post.
 
Upvote 0

Forum statistics

Threads
1,215,148
Messages
6,123,301
Members
449,095
Latest member
Chestertim

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