Need to Transpose these 1 to 6 columns into one single Column (multiple rows),Keeping the left 2 columns intact. Please help!

Suman Mehta

New Member
Joined
Aug 31, 2020
Messages
8
Office Version
  1. 2019
Platform
  1. Windows
Company NameCount of Names123456
Deco-Mica Ltd4Deco Mica LtdDeco-Mica LtdDeco MicaDeco-Mica
Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing Industries LtdBharat Textiles & ProofingBharat Textiles &Bharat Textiles
Sainik Finance & Industries Limited4Sainik Finance & Industries LimitedSainik Finance & IndustriesSainik Finance & IndustriSainik Finance &
G-Tech Info-Training Limited5G Tech Info Training LimitedG Tech Info TrainingG-Tech Info-Training LimitedG Tech InfoG-Tech Info-Training
Kome-on Communication Ltd.5Kome on Communication LtdKome-on Communication LtdKome On CommunicationKome on CommunicationKome-On Communication
Associated Alcohol and Breweries Ltd5Associated Alcohol & Breweries LtdAssociated Alcohols & BreweriesAssociated Alcohol & BreweriesAssociated Alcohol &Associated Alcohols
Indo US Bio-Tech Ltd.6Indo US Bio Tech LtdIndo US Bio-Tech LtdIndo US Bio TechIndo US Bio-TechIndo US BioTechIndo US Bio-Tech
Unick Fix-A-Form & Printers Ltd6Unick Fix A Form & Printers LtdUnick Fix A Form & PrintersUnick Fix A Form PrintersUnick Fix-A-Form & PrintersUnick Fix-A-Form PrintersUnick Fix A
CG-VAK Software & Exports Ltd.6CG VAK Software & Exports LtdCG VAK Software & ExportsCG Vak Software & ExportsCG-VAK Software & ExportsCG-Vak Software & ExportsCG VAK Software
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Welcome to the MrExcel board!

I suggest that you investigate XL2BB for providing sample data & expected results.

Is this what you mean? If not please post the expected results for your sample data and explain how you get those results.

VBA Code:
Sub Rearrange()
  Dim a As Variant, b As Variant
  Dim i As Long, j As Long, k As Long
  
  a = Range("A1", Range("A" & Rows.Count).End(xlUp)).Resize(, 8).Value
  ReDim b(1 To Application.Sum(Application.Index(a, 0, 2)), 1 To 3)
  For i = 2 To UBound(a)
    For j = 3 To 2 + a(i, 2)
      k = k + 1
      b(k, 1) = a(i, 1): b(k, 2) = a(i, 2): b(k, 3) = a(i, j)
    Next j
  Next i
  Range("A" & Rows.Count).End(xlUp).Offset(3).Resize(k, 3).Value = b
End Sub

Suman Mehta 1.xlsm
ABCDEFGH
1Company NameCount of Names123456
2Deco-Mica Ltd4Deco Mica LtdDeco-Mica LtdDeco MicaDeco-Mica
3Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing Industries LtdBharat Textiles & ProofingBharat Textiles &Bharat Textiles
4Sainik Finance & Industries Limited4Sainik Finance & Industries LimitedSainik Finance & IndustriesSainik Finance & IndustriSainik Finance &
5G-Tech Info-Training Limited5G Tech Info Training LimitedG Tech Info TrainingG-Tech Info-Training LimitedG Tech InfoG-Tech Info-Training
6Kome-on Communication Ltd.5Kome on Communication LtdKome-on Communication LtdKome On CommunicationKome on CommunicationKome-On Communication
7Associated Alcohol and Breweries Ltd5Associated Alcohol & Breweries LtdAssociated Alcohols & BreweriesAssociated Alcohol & BreweriesAssociated Alcohol &Associated Alcohols
8Indo US Bio-Tech Ltd.6Indo US Bio Tech LtdIndo US Bio-Tech LtdIndo US Bio TechIndo US Bio-TechIndo US BioTechIndo US Bio-Tech
9Unick Fix-A-Form & Printers Ltd6Unick Fix A Form & Printers LtdUnick Fix A Form & PrintersUnick Fix A Form PrintersUnick Fix-A-Form & PrintersUnick Fix-A-Form PrintersUnick Fix A
10CG-VAK Software & Exports Ltd.6CG VAK Software & Exports LtdCG VAK Software & ExportsCG Vak Software & ExportsCG-VAK Software & ExportsCG-Vak Software & ExportsCG VAK Software
11
12
13Deco-Mica Ltd4Deco Mica Ltd
14Deco-Mica Ltd4Deco-Mica Ltd
15Deco-Mica Ltd4Deco Mica
16Deco-Mica Ltd4Deco-Mica
17Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing Industries Ltd
18Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing
19Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles &
20Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles
21Sainik Finance & Industries Limited4Sainik Finance & Industries Limited
22Sainik Finance & Industries Limited4Sainik Finance & Industries
23Sainik Finance & Industries Limited4Sainik Finance & Industri
24Sainik Finance & Industries Limited4Sainik Finance &
25G-Tech Info-Training Limited5G Tech Info Training Limited
26G-Tech Info-Training Limited5G Tech Info Training
27G-Tech Info-Training Limited5G-Tech Info-Training Limited
28G-Tech Info-Training Limited5G Tech Info
29G-Tech Info-Training Limited5G-Tech Info-Training
30Kome-on Communication Ltd.5Kome on Communication Ltd
31Kome-on Communication Ltd.5Kome-on Communication Ltd
32Kome-on Communication Ltd.5Kome On Communication
33Kome-on Communication Ltd.5Kome on Communication
34Kome-on Communication Ltd.5Kome-On Communication
35Associated Alcohol and Breweries Ltd5Associated Alcohol & Breweries Ltd
36Associated Alcohol and Breweries Ltd5Associated Alcohols & Breweries
37Associated Alcohol and Breweries Ltd5Associated Alcohol & Breweries
38Associated Alcohol and Breweries Ltd5Associated Alcohol &
39Associated Alcohol and Breweries Ltd5Associated Alcohols
40Indo US Bio-Tech Ltd.6Indo US Bio Tech Ltd
41Indo US Bio-Tech Ltd.6Indo US Bio-Tech Ltd
42Indo US Bio-Tech Ltd.6Indo US Bio Tech
43Indo US Bio-Tech Ltd.6Indo US Bio-Tech
44Indo US Bio-Tech Ltd.6Indo US BioTech
45Indo US Bio-Tech Ltd.6Indo US Bio-Tech
46Unick Fix-A-Form & Printers Ltd6Unick Fix A Form & Printers Ltd
47Unick Fix-A-Form & Printers Ltd6Unick Fix A Form & Printers
48Unick Fix-A-Form & Printers Ltd6Unick Fix A Form Printers
49Unick Fix-A-Form & Printers Ltd6Unick Fix-A-Form & Printers
50Unick Fix-A-Form & Printers Ltd6Unick Fix-A-Form Printers
51Unick Fix-A-Form & Printers Ltd6Unick Fix A
52CG-VAK Software & Exports Ltd.6CG VAK Software & Exports Ltd
53CG-VAK Software & Exports Ltd.6CG VAK Software & Exports
54CG-VAK Software & Exports Ltd.6CG Vak Software & Exports
55CG-VAK Software & Exports Ltd.6CG-VAK Software & Exports
56CG-VAK Software & Exports Ltd.6CG-Vak Software & Exports
57CG-VAK Software & Exports Ltd.6CG VAK Software
Sheet1
 
Upvote 0
Company NameCount of Names123
Deco-Mica Ltd4Deco Mica Ltd
Deco-Mica Ltd4Deco-Mica Ltd
Deco-Mica Ltd4Deco Mica
Deco-Mica Ltd4Deco-Mica
Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing Industries Ltd
Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing
Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles &
Bharat Textiles & Proofing Industries Ltd.4Bharat Textiles
Sainik Finance & Industries Limited4Sainik Finance & Industries Limited
Sainik Finance & Industries Limited4Sainik Finance & Industries
Sainik Finance & Industries Limited4Sainik Finance & Industri
Sainik Finance & Industries Limited4Sainik Finance &
 
Upvote 0
Thankyou for the Suggestion, Peter.
This above is the expected result. Still not able to automate it. I have 40K+ rows of this type
 
Upvote 0
This can be easily done through Power Query.

Just See a Youtube video as how to do Unpivot data in Power Query.
 
Upvote 0
This can be easily done through Power Query.

Just See a Youtube video as how to do Unpivot data in Power Query.
Thank you, Punit. This worked.
But there is one problem as shown in the image( last column). it is only unpivoting 2 column data. Any idea why is this happening & how to fix this?
 

Attachments

  • Capture.PNG
    Capture.PNG
    67.2 KB · Views: 20
Upvote 0
It is working in my case. You to select all the Columns which you want to unpivot

My Example

Book1
ABCD
1Company NameRow NoAttributeValue
2Deco-Mica Ltd11Deco Mica Ltd
3Deco-Mica Ltd12Deco-Mica Ltd
4Deco-Mica Ltd13Deco Mica
5Deco-Mica Ltd14Deco-Mica
6Bharat Textiles & Proofing Industries Ltd.21Bharat Textiles & Proofing Industries Ltd
7Bharat Textiles & Proofing Industries Ltd.22Bharat Textiles & Proofing
8Bharat Textiles & Proofing Industries Ltd.23Bharat Textiles &
9Bharat Textiles & Proofing Industries Ltd.24Bharat Textiles
10Sainik Finance & Industries Limited31Sainik Finance & Industries Limited
11Sainik Finance & Industries Limited32Sainik Finance & Industries
12Sainik Finance & Industries Limited33Sainik Finance & Industri
13Sainik Finance & Industries Limited34Sainik Finance &
14G-Tech Info-Training Limited41G Tech Info Training Limited
15G-Tech Info-Training Limited42G Tech Info Training
16G-Tech Info-Training Limited43G-Tech Info-Training Limited
17G-Tech Info-Training Limited44G Tech Info
18G-Tech Info-Training Limited45G-Tech Info-Training
19Kome-on Communication Ltd.51Kome on Communication Ltd
20Kome-on Communication Ltd.52Kome-on Communication Ltd
21Kome-on Communication Ltd.53Kome On Communication
22Kome-on Communication Ltd.54Kome on Communication
23Kome-on Communication Ltd.55Kome-On Communication
24Associated Alcohol and Breweries Ltd61Associated Alcohol & Breweries Ltd
25Associated Alcohol and Breweries Ltd62Associated Alcohols & Breweries
26Associated Alcohol and Breweries Ltd63Associated Alcohol & Breweries
27Associated Alcohol and Breweries Ltd64Associated Alcohol &
28Associated Alcohol and Breweries Ltd65Associated Alcohols
29Indo US Bio-Tech Ltd.61Indo US Bio Tech Ltd
30Indo US Bio-Tech Ltd.62Indo US Bio-Tech Ltd
31Indo US Bio-Tech Ltd.63Indo US Bio Tech
32Indo US Bio-Tech Ltd.64Indo US Bio-Tech
33Indo US Bio-Tech Ltd.65Indo US BioTech
34Indo US Bio-Tech Ltd.66Indo US Bio-Tech
35Unick Fix-A-Form & Printers Ltd71Unick Fix A Form & Printers Ltd
36Unick Fix-A-Form & Printers Ltd72Unick Fix A Form & Printers
37Unick Fix-A-Form & Printers Ltd73Unick Fix A Form Printers
38Unick Fix-A-Form & Printers Ltd74Unick Fix-A-Form & Printers
39Unick Fix-A-Form & Printers Ltd75Unick Fix-A-Form Printers
40Unick Fix-A-Form & Printers Ltd76Unick Fix A
41CG-VAK Software & Exports Ltd.81CG VAK Software & Exports Ltd
42CG-VAK Software & Exports Ltd.82CG VAK Software & Exports
43CG-VAK Software & Exports Ltd.83CG Vak Software & Exports
44CG-VAK Software & Exports Ltd.84CG-VAK Software & Exports
45CG-VAK Software & Exports Ltd.85CG-Vak Software & Exports
46CG-VAK Software & Exports Ltd.86CG VAK Software
Sheet4
 
Upvote 0
Also try this formula based Answer with two helper column market in Yellow

This is a trial if you like it we can modify (As the formula wont work if you delete or add rows and column

Book1
ABCDEFGHIJKLMN
1Company Name-HelperRow No123456Company NameCountName
2Deco-Mica Ltd4-1.00Deco Mica LtdDeco-Mica LtdDeco MicaDeco-MicaDeco-Mica Ltd4Deco Mica Ltd
3Bharat Textiles & Proofing Industries Ltd.44.002.00Bharat Textiles & Proofing Industries LtdBharat Textiles & ProofingBharat Textiles &Bharat TextilesDeco-Mica Ltd4Deco-Mica Ltd
4Sainik Finance & Industries Limited48.003.00Sainik Finance & Industries LimitedSainik Finance & IndustriesSainik Finance & IndustriSainik Finance &Deco-Mica Ltd4Deco Mica
5G-Tech Info-Training Limited512.004.00G Tech Info Training LimitedG Tech Info TrainingG-Tech Info-Training LimitedG Tech InfoG-Tech Info-TrainingDeco-Mica Ltd4Deco-Mica
6Kome-on Communication Ltd.517.005.00Kome on Communication LtdKome-on Communication LtdKome On CommunicationKome on CommunicationKome-On CommunicationBharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing Industries Ltd
7Associated Alcohol and Breweries Ltd522.006.00Associated Alcohol & Breweries LtdAssociated Alcohols & BreweriesAssociated Alcohol & BreweriesAssociated Alcohol &Associated AlcoholsBharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing
8Indo US Bio-Tech Ltd.627.007.00Indo US Bio Tech LtdIndo US Bio-Tech LtdIndo US Bio TechIndo US Bio-TechIndo US BioTechIndo US Bio-TechBharat Textiles & Proofing Industries Ltd.4Bharat Textiles &
9Unick Fix-A-Form & Printers Ltd533.008.00Unick Fix A Form & Printers LtdUnick Fix A Form & PrintersUnick Fix A Form PrintersUnick Fix-A-Form & PrintersUnick Fix-A-Form PrintersUnick Fix ABharat Textiles & Proofing Industries Ltd.4Bharat Textiles
10CG-VAK Software & Exports Ltd.638.009.00CG VAK Software & Exports LtdCG VAK Software & ExportsCG Vak Software & ExportsCG-VAK Software & ExportsCG-Vak Software & ExportsCG VAK SoftwareSainik Finance & Industries Limited4Sainik Finance & Industries Limited
11Sainik Finance & Industries Limited4Sainik Finance & Industries
12Sainik Finance & Industries Limited4Sainik Finance & Industri
13Sainik Finance & Industries Limited4Sainik Finance &
14G-Tech Info-Training Limited5G Tech Info Training Limited
15G-Tech Info-Training Limited5G Tech Info Training
16G-Tech Info-Training Limited5G-Tech Info-Training Limited
17G-Tech Info-Training Limited5G Tech Info
18G-Tech Info-Training Limited5G-Tech Info-Training
19Kome-on Communication Ltd.5Kome on Communication Ltd
20Kome-on Communication Ltd.5Kome-on Communication Ltd
21Kome-on Communication Ltd.5Kome On Communication
22Kome-on Communication Ltd.5Kome on Communication
23Kome-on Communication Ltd.5Kome-On Communication
24Associated Alcohol and Breweries Ltd5Associated Alcohol & Breweries Ltd
25Associated Alcohol and Breweries Ltd5Associated Alcohols & Breweries
26Associated Alcohol and Breweries Ltd5Associated Alcohol & Breweries
27Associated Alcohol and Breweries Ltd5Associated Alcohol &
28Associated Alcohol and Breweries Ltd5Associated Alcohols
29Indo US Bio-Tech Ltd.6Indo US Bio Tech Ltd
30Indo US Bio-Tech Ltd.6Indo US Bio-Tech Ltd
31Indo US Bio-Tech Ltd.6Indo US Bio Tech
32Indo US Bio-Tech Ltd.6Indo US Bio-Tech
33Indo US Bio-Tech Ltd.6Indo US BioTech
34Indo US Bio-Tech Ltd.6Indo US Bio-Tech
35Unick Fix-A-Form & Printers Ltd5Unick Fix A Form & Printers Ltd
36Unick Fix-A-Form & Printers Ltd5Unick Fix A Form & Printers
37Unick Fix-A-Form & Printers Ltd5Unick Fix A Form Printers
38Unick Fix-A-Form & Printers Ltd5Unick Fix-A-Form & Printers
39Unick Fix-A-Form & Printers Ltd5Unick Fix-A-Form Printers
40CG-VAK Software & Exports Ltd.6CG VAK Software & Exports Ltd
41CG-VAK Software & Exports Ltd.6CG VAK Software & Exports
42CG-VAK Software & Exports Ltd.6CG Vak Software & Exports
43CG-VAK Software & Exports Ltd.6CG-VAK Software & Exports
44CG-VAK Software & Exports Ltd.6CG-Vak Software & Exports
45CG-VAK Software & Exports Ltd.6CG VAK Software
46   
47   
48   
49   
Sheet1
Cell Formulas
RangeFormula
B1B1=0
L2:L49L2=IF(ROWS($L$2:L2)>SUM($B$2:$B$10),"",VLOOKUP(LOOKUP(ROWS($1:1)-1,$C$2:$C$10,$D$2:$D$10),IF({1,0},$D$2:$D$10,$A$2:$A$10),2,0))
M2:M49M2=IF(ROWS($L$2:L2)>SUM($B$2:$B$10),"",VLOOKUP(LOOKUP(ROWS($1:1)-1,$C$2:$C$10,$D$2:$D$10),IF({1,0},$D$2:$D$10,$B$2:$B$10),2,0))
N2:N49N2=IF(ROWS($L$2:L2)>SUM($B$2:$B$10),"",INDIRECT(TEXT(((LOOKUP(ROWS($1:1)-ROWS($1:$1),$C$2:$C$10,$D$2:$D$10)*100)+100)+4+SUMPRODUCT(--((LOOKUP(ROW($1:1)-ROWS($1:$1),$C$2:$C$10,$D$2:$D$10))=LOOKUP(ROWS($1:1)-ROWS($1:$1),$C$2:$C$10,$D$2:$D$10))),"R00C00"),FALSE))
C3:C10C3=C2+B3-(B3-B2)
 
Upvote 0
This above is the expected result.
That appears to be identical to the first 12 rows of the results produced by my code (rows 13 to 24 in my screen shot). What were the first 12 rows of the results when you ran my code on the sample data from post 1?
Or else can you explain in what way my code failed for you?
 
Upvote 0
Also try this formula based Answer with two helper column market in Yellow

This is a trial if you like it we can modify (As the formula wont work if you delete or add rows and column

Book1
ABCDEFGHIJKLMN
1Company Name-HelperRow No123456Company NameCountName
2Deco-Mica Ltd4-1.00Deco Mica LtdDeco-Mica LtdDeco MicaDeco-MicaDeco-Mica Ltd4Deco Mica Ltd
3Bharat Textiles & Proofing Industries Ltd.44.002.00Bharat Textiles & Proofing Industries LtdBharat Textiles & ProofingBharat Textiles &Bharat TextilesDeco-Mica Ltd4Deco-Mica Ltd
4Sainik Finance & Industries Limited48.003.00Sainik Finance & Industries LimitedSainik Finance & IndustriesSainik Finance & IndustriSainik Finance &Deco-Mica Ltd4Deco Mica
5G-Tech Info-Training Limited512.004.00G Tech Info Training LimitedG Tech Info TrainingG-Tech Info-Training LimitedG Tech InfoG-Tech Info-TrainingDeco-Mica Ltd4Deco-Mica
6Kome-on Communication Ltd.517.005.00Kome on Communication LtdKome-on Communication LtdKome On CommunicationKome on CommunicationKome-On CommunicationBharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing Industries Ltd
7Associated Alcohol and Breweries Ltd522.006.00Associated Alcohol & Breweries LtdAssociated Alcohols & BreweriesAssociated Alcohol & BreweriesAssociated Alcohol &Associated AlcoholsBharat Textiles & Proofing Industries Ltd.4Bharat Textiles & Proofing
8Indo US Bio-Tech Ltd.627.007.00Indo US Bio Tech LtdIndo US Bio-Tech LtdIndo US Bio TechIndo US Bio-TechIndo US BioTechIndo US Bio-TechBharat Textiles & Proofing Industries Ltd.4Bharat Textiles &
9Unick Fix-A-Form & Printers Ltd533.008.00Unick Fix A Form & Printers LtdUnick Fix A Form & PrintersUnick Fix A Form PrintersUnick Fix-A-Form & PrintersUnick Fix-A-Form PrintersUnick Fix ABharat Textiles & Proofing Industries Ltd.4Bharat Textiles
10CG-VAK Software & Exports Ltd.638.009.00CG VAK Software & Exports LtdCG VAK Software & ExportsCG Vak Software & ExportsCG-VAK Software & ExportsCG-Vak Software & ExportsCG VAK SoftwareSainik Finance & Industries Limited4Sainik Finance & Industries Limited
11Sainik Finance & Industries Limited4Sainik Finance & Industries
12Sainik Finance & Industries Limited4Sainik Finance & Industri
13Sainik Finance & Industries Limited4Sainik Finance &
14G-Tech Info-Training Limited5G Tech Info Training Limited
15G-Tech Info-Training Limited5G Tech Info Training
16G-Tech Info-Training Limited5G-Tech Info-Training Limited
17G-Tech Info-Training Limited5G Tech Info
18G-Tech Info-Training Limited5G-Tech Info-Training
19Kome-on Communication Ltd.5Kome on Communication Ltd
20Kome-on Communication Ltd.5Kome-on Communication Ltd
21Kome-on Communication Ltd.5Kome On Communication
22Kome-on Communication Ltd.5Kome on Communication
23Kome-on Communication Ltd.5Kome-On Communication
24Associated Alcohol and Breweries Ltd5Associated Alcohol & Breweries Ltd
25Associated Alcohol and Breweries Ltd5Associated Alcohols & Breweries
26Associated Alcohol and Breweries Ltd5Associated Alcohol & Breweries
27Associated Alcohol and Breweries Ltd5Associated Alcohol &
28Associated Alcohol and Breweries Ltd5Associated Alcohols
29Indo US Bio-Tech Ltd.6Indo US Bio Tech Ltd
30Indo US Bio-Tech Ltd.6Indo US Bio-Tech Ltd
31Indo US Bio-Tech Ltd.6Indo US Bio Tech
32Indo US Bio-Tech Ltd.6Indo US Bio-Tech
33Indo US Bio-Tech Ltd.6Indo US BioTech
34Indo US Bio-Tech Ltd.6Indo US Bio-Tech
35Unick Fix-A-Form & Printers Ltd5Unick Fix A Form & Printers Ltd
36Unick Fix-A-Form & Printers Ltd5Unick Fix A Form & Printers
37Unick Fix-A-Form & Printers Ltd5Unick Fix A Form Printers
38Unick Fix-A-Form & Printers Ltd5Unick Fix-A-Form & Printers
39Unick Fix-A-Form & Printers Ltd5Unick Fix-A-Form Printers
40CG-VAK Software & Exports Ltd.6CG VAK Software & Exports Ltd
41CG-VAK Software & Exports Ltd.6CG VAK Software & Exports
42CG-VAK Software & Exports Ltd.6CG Vak Software & Exports
43CG-VAK Software & Exports Ltd.6CG-VAK Software & Exports
44CG-VAK Software & Exports Ltd.6CG-Vak Software & Exports
45CG-VAK Software & Exports Ltd.6CG VAK Software
46   
47   
48   
49   
Sheet1
Cell Formulas
RangeFormula
B1B1=0
L2:L49L2=IF(ROWS($L$2:L2)>SUM($B$2:$B$10),"",VLOOKUP(LOOKUP(ROWS($1:1)-1,$C$2:$C$10,$D$2:$D$10),IF({1,0},$D$2:$D$10,$A$2:$A$10),2,0))
M2:M49M2=IF(ROWS($L$2:L2)>SUM($B$2:$B$10),"",VLOOKUP(LOOKUP(ROWS($1:1)-1,$C$2:$C$10,$D$2:$D$10),IF({1,0},$D$2:$D$10,$B$2:$B$10),2,0))
N2:N49N2=IF(ROWS($L$2:L2)>SUM($B$2:$B$10),"",INDIRECT(TEXT(((LOOKUP(ROWS($1:1)-ROWS($1:$1),$C$2:$C$10,$D$2:$D$10)*100)+100)+4+SUMPRODUCT(--((LOOKUP(ROW($1:1)-ROWS($1:$1),$C$2:$C$10,$D$2:$D$10))=LOOKUP(ROWS($1:1)-ROWS($1:$1),$C$2:$C$10,$D$2:$D$10))),"R00C00"),FALSE))
C3:C10C3=C2+B3-(B3-B2)
Thanks a lot. I sorted the data in desc order and then it worked perfectly using power query. Will try this formula also.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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