Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use a function to format cells?
I have a report that I run in Excel, which pulls data from a text file into
a worksheet, placing each value in a cell, and then pulls info from these cells to create a report. One cell in particular normally has a series of characters/numbers then a dash, then another series of characters/numbers. I pull just the characters/numbers to the right of the dash to print on the report, several of these actually, well, four to be exact, and concatenate them with a comma separating. Problem is, for one customer in particular, their item number doesn't have dashes. This then makes the data on the report look weird with that one cell all stretched out like that, so I manually set the format of the cell to wrap text, then resize the cell so all the comma's line up to the right. I'd like to do this either using worksheet functions(I posted there as well) or, using a "macro" function. Right now to get the numbers after the dash and put the comma's in where they're supposed to be, I use this: =rightofdash('Veh 1 Data'!$J1) & "," & rightofdash('Veh 1 Data'!$J2) & "," & rightofdash('Veh 1 Data'!$J3) & "," & rightofdash('Veh 1 Data'!$J4) with "rightofdash" being a function that finds the dash, then pulls just the characters to the right of it. As you can see, I then concatenate them together to put the commas in. What I need to do is, with data that doesn't have the dash, is go ahead and concatenate them with the commas, but then have the cell automatically wrap and adjust to size, so the commas are in a line at the right. Something like this: Data before formatting: abcd,efgh,ijkl Data after formatting: abcd, efgh, ijkl Thanks!! Shawn |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 format cells to date format | Excel Discussion (Misc queries) | |||
want format cells alignment not format cells font style | Excel Discussion (Misc queries) | |||
Cells won't convert to number format, even after format/cells/num. | Excel Discussion (Misc queries) | |||
Function to format cells??? | Excel Worksheet Functions | |||
Function: Join Cells with Format | Excel Programming |