This question is on formatting/formulas and macros.
I run a daily report on all 7 of our locations, each location has its own separate report. This means the number of data lines can vary widely, so any formula must be flexible enough to catch the data whether it is 5 lines or 150 lines (line # 1 is the header line). I am trying to reduce the number of formatting steps I need to do, before transferring the data into my final reports, by creating macros for multi-step formatting. Can anyone help me with any of the “bumps in the road” I am coming across?
The report format I have is 8 columns:
A = blank
B = customer location (i.e. Q.56829-A)
C = account #
D= customer name
E = order status
F = service date (date of sale)
G = service time (time of sale)
H = hours:mins (since order placed) which comes across in this format: 1/2/1900 7:45:00 AM, but I have it pre-formatted to display as 55:45 (hours:mins)
I = payment method
Bump # 1:
I inserted the blank column A and I want it to display today’s date. [U]If columns B thru I, on the same line, are blank, I want the cell in column A to be blank, too, only fill in column A if there is data on that line).
The steps I did, in order:
in cell A2: =IF(B2<>””,TODAY(),””)
Format column A for date
Copy A2
Highlight Column A
Paste
But, I need to stop the paste at the first blank line. As a reminder, this is a daily report on 7 different locations, the number of lines will vary on each report, so setting it for a specific number of lines will not work. As a thought, do I need to change the sequence of events? For example, format the column for date before using the formula?
Bump # 2:
I sort the data by payment method and hours:mins (largest to smallest). I cut the lines for a specific payment type (purchase order) and place those lines further down the sheet (it needs to be worked with separately). I then need to go back to the non-purchase order lines and re-sort by hours:mins, so the longest times are listed on top (the “purchase order” lines are already sorted by time, from the first sort). I have the initial sorting in a macro, but when I try to program the second sort (separate macro), it re-sorts all of the data, not just the entries I have highlighted (I highlight first, before running the second macro). Is there a way I can program the second sort, in a macro, so it will sort only the lines I have highlighted?
Bump # 3:
In column H, I need to format in the number of days since the order was placed, not by hours:mins, if the payment method (column I) says “purchase order”. I am manually entering =DATEDIF(F2,A2,”D”) and format the cells for number, no decimals. Then I copy that down the lines. Logically, I should use =DATEDIF(IF(I:I,”purchase order”)(F2,A2,”D”)) but, it (or variations) do not work. Is there a formula that will automatically format column H if column I says “purchase order”, but will leave the hours:mins if not?
If all of these steps cannot be done in one macro, I can create as many as needed.
I apologize for this post being so long, I am just trying to be clear on the steps I need to do. Thank you for your help!
Bookmarks