-1

So I have a spreadsheet used for calculating let's say the taxes on something which I purchased. It has a column with the sales tax calculation, state tax, etc. and all each of these columns reference is the first column value (the price of whatever I purchased). I have the first row filled out with all the relative referencing done. Now when I go to add a price to the second line, none of these other columns autofill. I have to manually double click each of the 100 other columns for it to population down. I tried adding a first column with just numbers 1-1000 so it updates everything when I add a new price, but then the spreadsheet looks like a total mess with 0's, negative numbers, errors, etc. everywhere. I want to be able to just add that one number "price" on a new row column A, and have everything else fill out automatically each time I add something here. How can I achieve this?

Note: I already perused at Apply Formula to a Range of Cells without Drag and Drop for an answer and it's a different scenario they are discussing.

Prospero
  • 1
  • 1
  • 1

1 Answers1

1

Doing some reasoning here so bear with my guess at what precisely you are doing and what you are doing it with.

It SEEMS like you filled column A with whatever, 1-1000, just "dummy", holding pattern values and things went south. That strongly implies you have the formulas in all the other cells to the right of what you filled, hence all the ugly stuff. So my first tack here will be to address that and show you a trick to make it all nice-nice.

When you take an entire formula, simple or complex, that does something you wish but does not handle all the dressing it up to look nice stuff, or some of the "well now and then..." stuff, that's called "wrapping the formula" with some new function. Simple example: you do something that ends up with a string as a result but there are unfortunate spaces at the beginning or end, or multiple spaces together in the middle. You "wrap" everything so far with the TRIM() function so it strips out those offending spaces.

In this case, you have the formulas in place but don't want their mess showing unless there's a real value in column A. So wrap them (Just have to do it on the first row of them, the copy and paste down however far you feel will let you add data without other work for a decent while. Maybe a hundred rows? Maybe the thousand?) with the following IF() function:

=IF(A4="","",  (what you had goes here)  )

So all the cells in row 4 would look to see if A4 has an entry. If not, they all return "" (nothing, a blank-looking cell). When A4 DOES have something in it, they show the working formula's result all nice-looking and such.

However, there is something called a "Table" which was invented PRECISELY for the problem you are having. You'd have to highlight and Delete all the formulas in those cells you aren't using yet (including the dummy stuff in column A), just leaving formulas where real column A data exists. All the rows below cleared out with Delete.

Then select any cell IN the real data that exists, or highlight it all including headers, then go to your Ribbon and click on INSERT. The first section is the Tables section and the rightmost icon there, the third from the left, is "Table" — click it. It will open a small (really small) dialogue box with two things in it. First is Excel's guess at just what cells make up your table. It's usually pretty spot on unless you have stuff butted up to those cells which will confuse it. If it looks correct, continue on. If not, use your mouse to highlight everything, including your headers, so Excel can't get it wrong. Next, if you DO have headers, click to fill the box under that by "My table has headers", then click OK and you're done.

Now, when you enter something in the column A cell of a row, the rest of the row will fill down automatically with the formulas. That's why you had to get rid of all the muck you didn't like the look of anyway. You enter something in the A-cell and all the rest instantly fill. Nice. Some little points... I DO mean the next row. Not 40 empty rows and then you fill in the A-cell of the 41st. That's a non-starter... Also, if your formula needs to change for any reason, it's a nightmare. You'll change a cell's formula, then see the old formula fill in when you use the next row. It's complicated how to fix that. One thought for your stated use here would be if you use this over time, tax rates could change. The suggestion would be to make little tax rate lookup tables elsewhere, and in each cell's formula, use a lookup function, like XLOOKUP() or VLOOKUP() to look them up based upon a date (could need a column for the dates, eh?). That way, you can change or add to those little tables and the formula in your Table would not change.

Third best would be copying a row of formulas down each time you need a new row. Several ways you could do that. Aside from the obvious (highlight, copy, paste, right?) you can fill down each time you need to, just highlight as if about to copy and paste, then use the fill tool. You could even do something esoteric like define a Named Range using relative referencing that is the row you are on, except for the A-cell in that row, and then each time you need a new row, select a cell in a used row, then use the range box above A1, left of the F2-Editing bar to show and select that range by double clicking it from the box that drops down. That'd highlight the current row and you could copy, then go to a blank row and paste. You know, so you could save the awful effort of highlighting the row of formulas 'cause that'd do that for you.

Point is, that ain't the most fun of options. So use one of the first two, ESPECIALLY converting to a Table. Tables have other advantages too, though none would really look like they'd matter for your use here.

TABLES... I'm not their biggest fan, but that is so incredibly precisely what you need here and so easy to set up. Oh, just accept whatever Styling it wants to do. Change it later if you wish. Walk before running, eh?

Jeorje
  • 11
  • 1