I have this spreadsheet that is calculating differences between dates and current date. The source for the data came from a web page table where whomever created it came up with a crazy arrangement when dates were the same for a group of entries. They put the date in a single cell and stretched it to cover all the rows. Stated differently, the date appears in a single cell but applies to multiple rows. This makes sorting or examining the data difficult to impossible while preserving data integrity.
Example below:
I don't even know how this could be done - inserting a single cell row in a column that applies to multiple rows; so I'm at a loss to know how to undo it.
What I need is for the date values to be populated into a cell in each row. I would try to do it manually, but I don't know how to insert the cells I'd need or to resize the individual cells. If it matters, the cell row coordinates where the multi-row dates occur are always the row number of the first occurrence.
I guess my questions are 2:
1) How are the cells stretched across multiple rows and what happened to the cells they appear over - the subsequent cells in that column for the rows not presented?
2) Are there functions or formulas that would help me fix this, or am I going to have to do it manually?
The list runs to hundreds of entries; so I would prefer to avoid the tedious and error prone process of doing it manually. Also, I'm not VBA literate and cannot write a routine (even if I knew what variables to test for) to automate the process.
Crazy Cells
-
- UraniumLounger
- Posts: 9266
- Joined: 13 Feb 2010, 01:27
- Location: Deep in the Heart of Texas
Crazy Cells
You do not have the required permissions to view the files attached to this post.
Bob's yer Uncle
Dell Intel Core i5 Laptop, 3570K,1.60 GHz, 8 GB RAM, Windows 11 64-bit, LibreOffice,and other bits and bobs
(1/2)(1+√5) |
-
- StarLounger
- Posts: 72
- Joined: 27 Oct 2010, 16:49
- Location: Just short of Heaven
Re: Crazy Cells
In Excel 2010, to UnGroup the cells select the whole column and select 'Unmerge cells' from the 'Merge & Center' Menu.
From there you can write a macro to copy down the blank cells or if you don't need them delete rows with blank cells.
From there you can write a macro to copy down the blank cells or if you don't need them delete rows with blank cells.
Last edited by Rus on 17 Apr 2014, 19:33, edited 1 time in total.
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Crazy Cells
Web pages have their own methods to merge cells in tables, but in Excel it is done by selecting a bunch of cells and clicking "Merge and Center" on the Home tab of the ribbon:
Clicking the same button will unmerge the cells again. It acts as a toggle.
You can select the data, then run the following macro to unmerge the cells and fill the blanks:
Clicking the same button will unmerge the cells again. It acts as a toggle.
You can select the data, then run the following macro to unmerge the cells and fill the blanks:
Code: Select all
Sub UnmergeAndFill()
Dim rng As Range
Dim rngArea As Range
Selection.MergeCells = False
Set rng = Selection.SpecialCells(xlCellTypeBlanks)
rng.FormulaR1C1 = "=R[-1]C"
For Each rngArea In rng.Areas
rngArea.Value = rngArea.Value
Next rngArea
End Sub
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- UraniumLounger
- Posts: 9266
- Joined: 13 Feb 2010, 01:27
- Location: Deep in the Heart of Texas
Re: Crazy Cells
Thank you both, Rus and Hans!
I was able to do the merge and center command after selecting the column. I now have empty cells that I need to populate with the value in the last non-empty cell above them.
Hans, can you guide me toward learning what I need to know to create and run that macro?
Thanks again!
I was able to do the merge and center command after selecting the column. I now have empty cells that I need to populate with the value in the last non-empty cell above them.
Hans, can you guide me toward learning what I need to know to create and run that macro?
Thanks again!
Bob's yer Uncle
Dell Intel Core i5 Laptop, 3570K,1.60 GHz, 8 GB RAM, Windows 11 64-bit, LibreOffice,and other bits and bobs
(1/2)(1+√5) |
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Crazy Cells
First, select the range with the cells.
Press Alt+F11 to activate the Visual Basic Editor.
Select Insert | Module to create a new code module.
Switch to this thread in your browser.
Click 'Select All' above the code block, then press Ctrl+C to copy the code.
Switch back to the Visual Basic Editor.
Press Ctrl+V to paste the code.
Click anywhere in the code (somewhere between Sub ... and End Sub).
Press F5 or select Run | Run Sub/Userform to run the macro.
Switch back to Excel to view the result.
Press Alt+F11 to activate the Visual Basic Editor.
Select Insert | Module to create a new code module.
Switch to this thread in your browser.
Click 'Select All' above the code block, then press Ctrl+C to copy the code.
Switch back to the Visual Basic Editor.
Press Ctrl+V to paste the code.
Click anywhere in the code (somewhere between Sub ... and End Sub).
Press F5 or select Run | Run Sub/Userform to run the macro.
Switch back to Excel to view the result.
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Crazy Cells
You can also browse this thread...How to integrate macros into Excel...BobH wrote:Hans, can you guide me toward learning what I need to know to create and run that macro?
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Crazy Cells
A non-macro way (and still VERY quick, to do this filling in of blanks...BobH wrote:I now have empty cells that I need to populate with the value in the last non-empty cell above them.
1. Select the entire column (or range of cells) containing the intermittent blank cells
2. Press F5 (to open the Go To dialog)
3. Click the "Special" button
4. Select *blanks* from the Special Cells dialog
5. Click OK
6. Right click on ANY selected blank cell
7. From the context menu select Delete and the Entire Row.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78412
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Crazy Cells
Uh - how will deleting rows fill blank cells?
BTW, congrats on making post number 123456:
BTW, congrats on making post number 123456:
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Crazy Cells
I am so brainwashed in using/sharing THIS particular Excel tip, that it sneaked in without me realizing what Bob wanted...sorry!HansV wrote:Uh - how will deleting rows fill blank cells?
Here are the correct steps:
1. Select the entire column (or range of cells) containing the intermittent blank cells
2. Press F5 (to open the Go To dialog)
3. Click the "Special" button
4. Select *blanks* from the Special Cells dialog
5. Click OK
6. While the blank cells are selected, start to type and equal sign ( = )
7. Press the up arrow (which selects a cell above and creates a formula)
8. Press CTRL+ENTER to automatically fill the other blank cells with the same (relative) formula
9. Copy the column and paste as values
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Crazy Cells
TXHansV wrote:BTW, congrats on making post number 123456:
Do I get a choccie bar or something for that? (How about a KitKat?)
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- UraniumLounger
- Posts: 9266
- Joined: 13 Feb 2010, 01:27
- Location: Deep in the Heart of Texas
Re: Crazy Cells
You will have to speak with Viking Bob about the Kit Kat.Rudi wrote:TXHansV wrote:BTW, congrats on making post number 123456:
Do I get a choccie bar or something for that? (How about a KitKat?)
Bob's yer Uncle
Dell Intel Core i5 Laptop, 3570K,1.60 GHz, 8 GB RAM, Windows 11 64-bit, LibreOffice,and other bits and bobs
(1/2)(1+√5) |