Thread: Macro Question
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
J_Knowles J_Knowles is offline
external usenet poster
 
Posts: 28
Default Macro Question

Send me the file. Click on J_Knowles in the header of this message to get my
email address (remove the NO.SPAMs). Send me the spreadsheet with the
original post data points (2000.00, 2050.00, 2083.25....)
--
Data Hog


"cranen" wrote:

Would you let me send you a file? If not, I will try to explain it here. I
have a table that takes up Columns A:M. This table consists of field data
(The first two rows are headings). The only columns that will be used for
adding the 50 foot stationing are Columns C, D, E, F, and G (Rows 3 through
16 actually have data but there is a possibility of more in the future). I
have written a formula that adds the 50 foot stationing (It places each row
of field data with added stationing into a column starting at Q) (Con - I
have to drag it out so far because I never know where the field data will
fall), but you might be able to use a macro to get the same results without
the excess data. The formula I use in the first cell is:

=ROUNDDOWN(C3,-2)

the formulas in the cells following cell 1:

=IF(AND(($C$3-Q3)<50,($C$3-Q3)0),$C$3,IF(AND(Q3=$C$3,(Q3+50)<$D$3),CEILING(Q 3,50),IF(AND(($D$3-Q3)<50,($D$3-Q3)0),$D$3,IF(AND(Q3=$D$3,
(Q3+50)<$E$3),
CEILING(Q3,50),IF(AND(($E$3-Q3)<50,($E$3-Q3)0),$E$3,IF(AND(Q3=$E$3,(Q3+50)<$F$3),CEILING(Q 3,50),IF(AND(($F$3-Q3)<50,($F$3-Q3)0),$F$3,IF(AND(Q3=$F$3,
(Q3+50)<$G$3),CEILING(Q3,50),IF(AND(($G$3-Q3)<50,($G$3-Q3)0),$G$3,IF(Q3=$G$3,CEILING(Q3,50),MROUND(Q3,(Q 3+50))))))))))))

The 39 cells of data is created by the formula. Not all rows of field data
will actually produce 39 cells of useful data. Was the code written to do
away with the formula? Thanks for all the help and time. Let me know what
you think.

"J_Knowles" wrote:

My code was written for the curve values to be in one column A2:A40 (39 rows
x 1 column). It is possible to use this scheme if you can use only one row
say T2:BF2 (39 columns x 1 row). It appears your data is in a range like
T2:AM3 (2 rows x 20 columns). In that case, this code will not work. Let me
know if you can modify your curve data to be in one column or one row and the
exact cell range where your curve data is located on your revised spreadsheet.
--
Data Hog


"cranen" wrote:

I think I need a macro for the following situation. I have a table (Curve
Data) where data is entered across 5 columns. The data in the table is from
the field, and in order to do further calculations, it needs data added to
it. So, I have a formula that rounds down the lowest value to the nearest
multiple of 50 (depending on what that value is it might create two values
below it) and creates a new low value (ex. 2083.25 ~ 2050.00), adds multiples
of 50 from the lowest value to the highest value (ex. 2050.00, 2083.25,
2100.00, 2150.00, .... 2383.25, 2400.00, etc.), and it rounds the highest
value to the nearest multiple of 50 and creates a new high value. Well, I
end up with a lot of excess data as you can see below (Mainly because I never
know where the last field data value will land - I have extended the formula
to a row at which I think the last field data value will never cross).

2000.00
2050.00
2083.25
2100.00
2150.00
2200.00
2250.00
2300.00
2350.00
2383.25
2400.00
2448.23
2450.00
2500.00
2511.02
2550.00
2600.00
2650.00
2700.00
2750.00
2800.00
2811.02
2850.00
2900.00
2950.00
3000.00
3050.00
3100.00
3150.00
3200.00
3250.00
3300.00
3350.00
3400.00
3450.00
3500.00
3550.00
3600.00
3650.00

I want to be pointed in the right direction on how to filter this data. I
need a range of data that follows the rules below to be copied somewhere else:

1. The value that comes right before the first field data value (2050.00).

2. The value that comes right after the last field data value (2850.00).

3. The values that come between values 2050.00 and 2850.00

Thank you so much for your help. If I am missing some info please let me know