past without blanks

PIsabel

Board Regular
Joined
Feb 4, 2014
Messages
121
Office Version
  1. 365
Platform
  1. Windows
I have a sheet with 30,000 lines and 37 columns.
Each row has a cell that concatenates all the data entered from all the cells in that row.
Then I copy these cells (A1:A30000) and paste them onto another sheet.
For some reason, which I don't know, when I copy and paste values and then sort them, the cells are divided, one part sorted from A1 downwards and the rest sorted from A30,000 upwards.
Can anyone help me with a code that solves my problem?
I need all the data to be together and sorted in ascending order.
Can anyone help me with a code that does this?
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
its probably sorting as text and not numbers
do you paste value - so only the value is in the cell and not a formula

do you have an example we can see

for example
A1
A3
A5
etc all odd numbers in a list

will actually sort like this, so the 1's are together , then the 2's



a1
a11
a13
a15
a17
a19
a21
a23
a25
a27
a29
a3
a31
a33
a35
a37
a39
a41
a43
a45
a47
a5
a7
a9
 
Upvote 0
this is what I have.



_10075.jpg
 

Attachments

  • _10072.jpg
    _10072.jpg
    192.4 KB · Views: 7
Upvote 0
cannot see very well in the image or the formulas and copy - but it may be better to share the actual spreadsheet - or put in xl2bb - so we can see the issue

Note: Images are difficult to see , and also requires that I input all the data myself, which means I may make an error, which is very time consuming, and from my point of view less likely to get a response, if a complicated spreadsheet. Plus we cannot see any of the formulas used.

other members may know what you want and answer the post anyway - but i would need an example

Therefore -

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone

------
 
Upvote 0
teste.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACAD
1ARTIGOFabricoPolimentoRef.Cod. barrasDescriçãoPCPVPCod. componenteFornec.
2Ref.Cod. barrasDescriçãoPCPVPCod. componenteFornec.Ref.Cod. barrasDescriçãoPCPVPCod. componenteFornec.Ref.Cod. barrasDescriçãoPCPVPCod. componenteFornec.82993Cama lacado preto + estofo azul para colchão 1,60 x 2,00 | | | | riviera honey cor 81 - 2,5550104582993
382994Mesa de cabeceira lacado c/ 2 gavetas | | lacado preto mate15039082994
482997lacar mesa de cabeceira - L 0,60 x 0,50 x 0,38 | amostra de cor ARC - LM156516082997
582993Cama lacado preto + estofo azul para colchão 1,60 x 2,00 | | | | riviera honey cor 81 - 2,555010458299382993.Fabrico1 - - Cama lacado preto + estofo azul para colchão 1,60 x 2,002408299301antonio82993..Polimento - - Cama lacado preto + estofo azul para colchão 1,60 x 2,001658299302custodio82998lacar cama L 1,24 x 0,98 | amostra de cor ARC - LM1514532082998
682994Mesa de cabeceira lacado c/ 2 gavetas | | lacado preto mate1503908299482994.Fabrico1 - - Mesa de cabeceira lacado c/ 2 gavetas858299401antonio82994..Polimento - lacado preto mate - Mesa de cabeceira lacado c/ 2 gavetas658299402custodio82999Módulo estante lacar L0,90 x 1,32 x 0,38 | amostra de cor ARC - LM1511023882999
7829912lacar móvel TV + gaveta | | 240494829912
8
982997lacar mesa de cabeceira - L 0,60 x 0,50 x 0,38 | amostra de cor ARC - LM15651608299782997..Polimento - amostra de cor ARC - LM15 - lacar mesa de cabeceira - L 0,60 x 0,50 x 0,38658299702custódio
1082998lacar cama L 1,24 x 0,98 | amostra de cor ARC - LM151453208299882998..Polimento - amostra de cor ARC - LM15 - lacar cama L 1,24 x 0,981458299802custódio
1182999Módulo estante lacar L0,90 x 1,32 x 0,38 | amostra de cor ARC - LM151102388299982999..Polimento - amostra de cor ARC - LM15 - Módulo estante lacar L0,90 x 1,32 x 0,38 1108299902custódio
12
13
14829912lacar móvel TV + gaveta | | 240494829912829912.Fabrico1 - - lacar móvel TV + gaveta4082991201antonio829912..Polimento - - lacar móvel TV + gaveta20082991202custodio
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29829912.Fabrico1 - - lacar móvel TV + gaveta4082991201antonio
30829912..Polimento - - lacar móvel TV + gaveta20082991202custodio
3182993.Fabrico1 - - Cama lacado preto + estofo azul para colchão 1,60 x 2,002408299301antonio
3282993..Polimento - - Cama lacado preto + estofo azul para colchão 1,60 x 2,001658299302custodio
3382994.Fabrico1 - - Mesa de cabeceira lacado c/ 2 gavetas858299401antonio
3482994..Polimento - lacado preto mate - Mesa de cabeceira lacado c/ 2 gavetas658299402custodio
3582997..Polimento - amostra de cor ARC - LM15 - lacar mesa de cabeceira - L 0,60 x 0,50 x 0,38658299702custódio
3682998..Polimento - amostra de cor ARC - LM15 - lacar cama L 1,24 x 0,981458299802custódio
3782999..Polimento - amostra de cor ARC - LM15 - Módulo estante lacar L0,90 x 1,32 x 0,38 1108299902custódio
Folha1
 
Upvote 0
ok thanks for using xl2bb
Each row has a cell that concatenates all the data entered from all the cells in that row.
Then I copy these cells (A1:A30000) and paste them onto another sheet.
how is that done - i dont see any formulas in cell A1

sorry --- really not following what you have copied into the xl2bb and what the issue is
would you mind explaining what you are after based on the xl2bb you have just posted
 
Upvote 0
I apologize.
I explained everything poorly.
Using the example I sent.
I have to copy:
A3:G30000
H3:N30000
O3:U30000
that are on sheet1 to
X2 which is on sheet2
All data on sheet 1 are the result of formulas and must be pasted as text on sheet 2

I'm using this code.
Comp_artigos = A3:G30000
Comp_fabrico =H3:N30000

VBA Code:
    Application.Goto Reference:="Comp_artigos"
    Selection.Copy
    Sheets("Componentes").Select
    Range("X2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=True, Transpose:=False
    '
    Sheets("Compostos").Select
    Application.Goto Reference:="comp_fabrico"
    Selection.Copy
    Sheets("Componentes").Select
    Range("X30000").End(xlUp).Offset(1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=True, Transpose:=False
 
Upvote 0
OH - ok, its VBA , I dont provide answers to VBA questions here , sorry about that
hopefully another member with VBA knowledge will be along and help soon
 
Upvote 0
I think your sort is being impacted by 2 things.
1) I suspect the empty cells actually contain an null string ie formulas returning ""
2) your Ref column contains a mix of numbers and strings ie 82993 and 82993.. (trailing full stops)
Can we convert all the numbers to strings in the output ? ie format the output column as Text ?
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,991
Members
449,094
Latest member
masterms

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