PC Review


Reply
Thread Tools Rate Thread

3 numbers in each cell aligned verticaly one number in each cell

 
 
Mikhail Bogorad
Guest
Posts: n/a
 
      25th Jun 2010
i have a bunch of records that have 3 numbers in each cell and are
presented like this one

cell B2= $0.00 $0.00 $0.00; cell C2 =$5,705,412.00 $2,400,000.00
$2,500,000.00 cell D2 = $5,909,484.00 $2,322,398.00 4,122,300.00

So what i want to do is to alighn all numbers vertically with one
number in each cell, so they'll look like the following:

B2=$0.00 C2=$5,705,412.00 D2 =$5,909,484.00
B3=$0.00 C3=$2,400,000.00 D3 =$2,322,398.00
B4=$0.00 C4=$2,500,000.00 D4=$4,122,300.00

i have like a hundred records like this
Any ideas?

Cheers


 
Reply With Quote
 
 
 
 
Don Guillett Excel MVP
Guest
Posts: n/a
 
      25th Jun 2010
On Jun 25, 8:32*am, Mikhail Bogorad <mikhail.bogo...@gmail.com> wrote:
> i have a bunch of records that have 3 numbers in each cell and are
> presented like this one
>
> *cell B2= $0.00 $0.00 $0.00; cell C2 =$5,705,412.00 $2,400,000.00
> $2,500,000.00 cell D2 = $5,909,484.00 $2,322,398.00 4,122,300.00
>
> So what i want to do is to alighn all numbers vertically with one
> number in each cell, so they'll look like the following:
>
> B2=$0.00 * *C2=$5,705,412.00 *D2 =$5,909,484.00
> B3=$0.00 * *C3=$2,400,000.00 *D3 =$2,322,398.00
> B4=$0.00 * *C4=$2,500,000.00 *D4=$4,122,300.00
>
> i have like a hundred records like this
> Any ideas?
>
> Cheers

Try this which assumes text of $ and 3 numbers per cell.

Sub SASparsecells()
Dim i As Long
Dim x As Double
Dim j As Integer
Range("c2:c4").Copy Range("b2")
For i = 2 To Cells(2, Columns.Count).End(xlToLeft).Column
x = InStrRev(Cells(2, i), "$")
On Error Resume Next
Do Until x < 3
For j = 4 To 2 Step -1
'MsgBox Mid(Cells(2, i), x, 256)
Cells(j, i).Value = Mid(Cells(2, i), x, 256)
Cells(2, i) = Left(Cells(2, i), x - 1)
x = InStrRev(Cells(2, i), "$", x - 1)
Next j
Loop
Next i
End Sub
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to select a cell to the left of the right aligned cell with th =?Utf-8?B?RGltYQ==?= Microsoft Excel Discussion 2 31st May 2007 08:19 AM
Numbers left-aligned in a cell Epinn Microsoft Excel New Users 4 12th Oct 2006 07:44 PM
Why data in cell doesn't stay aligned with cell borders when prin. =?Utf-8?B?RGFubm8=?= Microsoft Excel Misc 0 3rd Oct 2005 07:15 PM
Display one number in a cell even though 2 numbers get pasted into the same cell? DrSues02 Microsoft Excel Misc 1 6th Oct 2004 12:04 AM
Display one number in a cell even though 2 numbers get pasted into the same cell? DrSues02 Microsoft Excel Misc 2 4th Oct 2004 11:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:31 PM.