how to create column of cell-by-cell sums in excel - excel

I have a spreadsheet that is extremely long and I would like to create a new column (actually, 8) where each cell in the new column is the sum of two cells in other columns. An obvious answer is to create the column, create an instance of the formula in the first cell, and drag the formula down. However, since the spreadsheet is so long and I would like to do this 8 times, that process does not make sense for me. Is there an automated way to do this? I have never worked with VBA but have enough programming experience that I figure I could figure it out. Thank you.

What I do, E.g. long data in columns A & B
Put formula in C1 & D1
Click in B1, Ctrl+down-arrow to go to the last cell, go over to C & D & type in any value
Click C1, Shift+ctrl+down-arrow to select the empty cells, same with left-arrow to select horizontally
ctrl+D to fill with the formula

highlight the cell(s). double click on the black box in the corner, and the formula gets filled down to the end of the data next to it.
In pictures:
hover here:
Your cursor should change to a black + when you are hovering over the dot.
After you double click, the formula will be filled down
this way will copy the formatting of that cell, but if you don't want that, you can click on the menu popup (lower left of filled area)
and select fill without formatting

Related

Excel flash fill rows automatically to adjacent rows until the next value?

I have a spreadsheet file that looks like this:
What I want is to fill the yellow fields with the last value on the left, so for CA it will fill until 26, and NYC until 81 before SG. What's the best way to achieve this, since I have literary hundreds of these?
I have tried using flash fill and paste specials, but they only work for rows downwards, and not for adjacent rows. I also used the Home>Fill series to the right, but then it overlaps another row when I highlight them all (so it shows CA instead of NYC, SG and MC).
Can anybody help me with this problem? Thanks so much!
try this:
select from the cell CA to the last yellow highlighted cell
hit F5 or Ctrl-G to open the Go To dialog
click the Special button
in the dialog tick blanks and hit OK
now only the empty cells are selected.
without changing that selection, type a = sign
hit the left arrow, this will add a cell reference after the = sign
hold down the Ctrl key and hit Enter
Now all previously empty cells have a formula that refers to the cell to the left.
If you want, you can select all cells again and use Paste Special > Values to overwrite the formulas with the result.

Conditional formatting depending on data from a column

I'd like to create a rule that writes "100%" in column A whenever I write "end" in column B.
So it would be something like this:
[] X
100% end
[] Y
The brackets represent an empty cell.
I've tried:
IF(B1:B3="end",100%,"")
but I would like to leave the cells on column A empty, with no data or formulas, if the respective cell in column B doesn't contain "end".
So I've thought about adding a new rule with conditional formatting but it's not working. Any solutions?
Can be achieved with CF but rather nastily. You would need to fill ColumnA first, say with 1s - but can be hidden by (standard) formatting the text to match the background colour (ie usually white).
Then clear any CF from and select ColumnA, HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true::
=B1="end"
Format..., select Black (probably) font and Custom Number format of:
00%
OK, OK.
If your blank cells must remain blank in reality rather than appearance then CF alone is not a solution for you.
Edit:
You can get a value to show in a cell based on the value of another cell, without having anything* in the cell, and without VBA:
                                                         *kinda
Using cells I2:J9 as an example, the steps are:
Click I2, then Ctrl+1 to open the Format Cells dialog.
On the Number tab, click Custom, then in the Type box enter: ;;; and click OK.
Hit Alt+O+D+N to add new Conditional Format and choose Use a formula to determine which
cells to format.
In the Format values where... box, enter: =J2="end" (If Excel adds $'s, remove them), then click Format...
On the Number tab, click Custom, then in the Type box enter: ;;;"100%" . (Optionally set a color, font, etc.) then hit ENTER 3 times to return to the
worksheet.
Click I2, hit your SPACEBAR once and then hit ENTER. (* Fine, I
confess: the cell isn't totally empty.)
Click I2 and hit Ctrl+C to Copy.
Select I2:J9 and press Alt+E+S+T then hit
ENTER to Paste Formats.
Now when you type end into any of J2:J9, the corresponding cell in column I will display 100%.
You can also repeat this process to add additional conditions to the same cells if needed.
Original Answer: (Alternative Solutions)
Sometimes I get stuck spending too much time on a question about a very minor issue. This is one of those times. :)
Thinking further about your question, I suspect you might not have meant you need the "cells on column A empty, with no data or formulas", but perhaps you mean you want the cells to "appear empty".
Example:
These cells do appear empty, unless you to click on the cell and then look at the formula bar:
...but the formula bar can be hidden too:

How do you display the contents of one cell to another in excel?

I want to display the contents in column a in column b.
fx =(cell_reference)
when u do that in column a, drag it down for as many rows as needed.
fx =transpose(cell_array_reference)
choose the starting cell then ":" then the last row you want. This will auto list them swapping the row and column position.
Enter "=" then click the cell who's content you wand displayed. Hit enter.
Once it's working for the first cell, grab the little indicator in the corner of the cell and drag it down to do the same thing for the entire column.

Conditional data entry on certain text in excel

I'm after some pointers.
I want to input text into some cells based on the contents of others.
Current formula that I'm using in cell B1 is
=IF(ISERROR(FIND("example",A1)),"no","yes")
So far, so simple. This works. Inputs 'yes' in B1 if 'example' is located in the cell A1, copy down.
However, there are some cells in the B column which have already been formatted with other text in, and I want to apply this formula on the entire spreadsheet without removing the existing text in column B. So far, the only thing I can think of is by putting this formula in the C column, copying down then moving the text from the C column to the B column - but this requires laborious copy and pasting that kind of negates the time saving provided by the formula.
What is the best way to achieve this? Do I need to resort to VB to scan the entire sheet, iterating through A1-A30000 and inserting the requisite text in B column?
Cheers.
Edit:
So, this has been pretty much sorted, with a variety of suggestions.
However, the actual formula I'm using is:
=IF(ISERROR(FIND("example",A1)),"","yes")
as I only want text to be put in columnB if the pattern is found. This has presented another problem! The double quotes signifying no replacement if the pattern ISN'T found actually inserts a 'NULL' character in there; when you try and select the blank cells on the next iteration of the operation, no cells are selected, as even though there is no visible character, Excel thinks there is. xD
This is solved by writing a macro function to remove Null characters.
Excel is infuriating sometimes. :P
All of the information and advice already given is definitely correct and gets the job done,
byt thought I'd add one that does not require ANY changes to the existing data (eg sorting or filtering):
Put your formula as you described is cell B1. Apply any conditional formatting to that cell, as required.
Now select and copy (ctrl+C) cell B1. Select column B (click on column heading).
Then Click find and Select (binoculars icon) - on Home ribbon tab. Choose go to Special.
In the popup choose Blanks and click ok. You will note all blank cells in colum B are selected. Don’t click anything, press Crtl-V.
Voilà, your formula and conditional formatting is pasted into all blank cells, leaving the rest alone.
Quick keyboard sequence:
select B1
Press ‘Ctrl + C’
Ctrl + ‘Space Bar’
Press ‘Ctrl + G’
Press Tab twice to go to ‘Special…’ button, press Enter
Press ‘K’ for blanks, Press Enter
Press ‘Ctrl + V’
(optional) press escape to remove selection from B1
There are a few ways to deal with this. I'll explain 2 of them :
If sorting is an option, sort your table by column B (ascending / A-Z) to get all the empty values at the top. Write your formula in the first blank cell and extend it by double-clicking the bottom-right corner of that cell.
If you cannot sort, apply filters to the table and select only the blank cells in column B. Then write the formula in the first blank cell and extend it by dragging it down to the last cell.
You might combine your existing B column values with those to be added conditionally in a single formula, say in ColumnC, such as:
=IF(ISBLANK(B1),IF(ISERROR(FIND("example",A1)),"no","yes"),B1)
copied down to suit. Then if ColumnB has become redundant, copy ColumnC, Paste Special, Values over the top and delete ColumnB. The result is to convert the formulae to the results thereof, that may increase processing speed but reduce the ease of handling additional rows (if any) subject to the same requirements.

Selecting a range from bottom to top in Excel?

Let's say I need to select a range in Excel from A2 to A1,(if I'm inserting something, it needs to insert to a2 first).
No matter which direction I choose, Excel automatically chooses Sheet1!$A$1:$A$2. I tried to even manually change it to Sheet1!$A$2:$A$1 but that didn't work.
How can I either disable this automatic selection or how to choose a range from bottom to top?
The real alternative would seem to be not to insert into A2 before inserting into A1 but to insert into A2 first and then keep inserting into A2, with Shift cells down.
From bottom to top you have to select range from bottom, like I did in my countif formula:
=COUNTIF($AA$8:AA8,AA8)
I locked AA8 cell and made it range with same cell because there were no other rows above the current row. And criteria was again this cell so I got my result.

Resources