Split Value

vijaychennai

Board Regular
Joined
Dec 7, 2009
Messages
239
Hello All,

good day. I have excel file in the below format.


Sheet Name :- Sheet1


QTYDataValueSolutionQTYDataValue
1TSKdesc11TSKdesc1
2ASDDESC2011ASDDESC201
1ASDFdes301ASDDESC201
1ASDFdes30

<tbody>
</tbody>
 
Last edited by a moderator:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try


[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][td="bgcolor: #DCE6F1"]
F
[/td][td="bgcolor: #DCE6F1"]
G
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
QTY​
[/td][td]
Data​
[/td][td]
Value​
[/td][td][/td][td]
QTY​
[/td][td]
Data​
[/td][td]
Value​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
1​
[/td][td]
TSK​
[/td][td]
desc1​
[/td][td][/td][td]
1​
[/td][td]
TSK​
[/td][td]
desc1​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
2​
[/td][td]
ASD​
[/td][td]
DESC201​
[/td][td][/td][td]
1​
[/td][td]
ASD​
[/td][td]
DESC201​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
1​
[/td][td]
ASDF​
[/td][td]
des30​
[/td][td][/td][td]
1​
[/td][td]
ASD​
[/td][td]
DESC201​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td][/td][td][/td][td][/td][td][/td][td]
1​
[/td][td]
ASDF​
[/td][td]
des30​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Array formula in F2 copied down
=IF(ROWS(F$2:F2)>SUM(A$2:A$4),"",INDEX(B$2:B$4,IFERROR(1+MATCH(ROWS(F$2:F2)-1,SUBTOTAL(9,OFFSET(A$2,,,ROW(A$2:A$4)-ROW(A$2)+1))),1)))
confirmed with Ctrl+Shift+Enter, not just Enter

Formula in E2 copied down
=IF(F2<>"",1,"")

Formula in G2 copied down
=IF(F2="","",VLOOKUP(F2,B:C,2,0))

Hope this helps

M.
 
Upvote 0
Try:-
NB:- This code will alter your data. !!
Code:
[COLOR="Navy"]Sub[/COLOR] MG21Mar22
[COLOR="Navy"]Dim[/COLOR] Lst [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
Lst = Range("A" & Rows.Count).End(xlUp).Row
[COLOR="Navy"]For[/COLOR] n = Lst To 2 [COLOR="Navy"]Step[/COLOR] -1
    [COLOR="Navy"]If[/COLOR] Cells(n, 1) > 1 [COLOR="Navy"]Then[/COLOR]
        [COLOR="Navy"]For[/COLOR] Ac = 1 To Cells(n, 1) - 1
            Cells(n, 1) = 1
            Cells(n, 1).Resize(, 3).Copy
            Cells(n + Ac, 1).Insert shift:=xlDown
        [COLOR="Navy"]Next[/COLOR] Ac
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] n
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Last edited:
Upvote 0
You're welcome
NB:- You could try the code with the "Screenupdating" might improve the time !!!
Code:
[COLOR="Navy"]Sub[/COLOR] MG21Mar40
[COLOR="Navy"]Dim[/COLOR] Lst [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
Application.ScreenUpdating = False
Lst = Range("A" & Rows.Count).End(xlUp).Row
[COLOR="Navy"]For[/COLOR] n = Lst To 2 [COLOR="Navy"]Step[/COLOR] -1
    [COLOR="Navy"]If[/COLOR] Cells(n, 1) > 1 [COLOR="Navy"]Then[/COLOR]
        [COLOR="Navy"]For[/COLOR] Ac = 1 To Cells(n, 1) - 1
            Cells(n, 1) = 1
            Cells(n, 1).Resize(, 3).Copy
            Cells(n + Ac, 1).Insert shift:=xlDown
        [COLOR="Navy"]Next[/COLOR] Ac
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] n
Application.ScreenUpdating = True
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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