How can an empty cell have formula? - excel

Imagine a sheet like this:
A1 = 1
B1 = 1
C1 = A1+B1
It has about 20 rows, to make the it work on next rows I have to copy the C1 content and paste it on column C.
But I noticed that I don't need to do that, and every time I put data on A and B column, the column next to B, which is C, automatically sums them up.
For example: In Row 21, C21 is empty, but If I put data in A21 and B21, the C1 automatically sums them up without having any formula in it.
How's that possible?

If you have a repeating pattern, Excel tries to carry it on for you.
So, if you have headers in A1/B1/C2, numbers in A2:B20, and a formula in C2:C20 to add the values in columns A and B, then type a value in A21, hit [Tab], type a value in B21 and then hit Tab or Enter, the Column C formula will automatically be copied into cell C21.
Testing exactly that (Add headers, start in A2: value, Tab, Value, Tab, =RC[-2]+RC[-1], Enter, loop), Excel started autofilling in cell C6 (i.e. the 5th row of data)

its possible that you have the autoadd function activated on that cellAuto-sum Excel, which do that add without put any formula.

Related

Excel Formula to compare single cell value with the whole column and return the value for a particular row where match found

I need to compare the B2 Cell value (6012469) with Column A i.e. cell A2 to A10 and return the b2 cell value (6012469) in column C where the value matches i.e. cell C5,C7, C9 AND C10 and NA in remaining cells where the value is not matched.
I have around 15000 rows of data is column A and need to automate the process.
I have attached the sample image for reference.
[1]: https://i.stack.imgur.com/DvzC3.png
Select any cell inside your data range in Column A. Go to your ribbon, click Home > Format as Table. It doesn't matter what colour scheme you choose.
Make sure that all your data in Col A plus Cols B & C are included in the table.
Then, in any cell of your table in Col C (e.g. in C2), paste this formula:
=IF(ISNUMBER(SEARCH($B$2,[#[Column A]])),$B$2,"")
Excel should automatically populate all of your Col C in the table with this formula. (If it doesn't, then you should see a little clickable prompt next to the cell asking if you want to overwrite all the other Col C cells with this formula.)
The table with the Col C formulas would look something like this:
Note: Of course, you could achieve something very similar without using a structured table, but not as conveniently as this because you would have to copy the formulas down to the other approx. 15000 rows. Even the Fill Down feature is not as convenient.
ADDITIONAL: a different formula in response to the asker's request that each cell in Column C match any of multiple values in Column B --
=IFERROR(INDEX($B$2:$B$4,MATCH(TRUE,ISNUMBER(SEARCH($B$2:$B$4,A2)),0)),"")
NOTE: if more than one Column B value matches a Column A cell, Column C will display Column B's topmost match

Fill blank value in Excel

Need help in Excel for the following problem
ColA ColB
A1 B1
A2 B2
A3 B3
A4
A5 B5
A6 A6
A6
A6
if Column B is blank, I need to copy the value of ColA into ColB. But if the value is already present, then no action is needed.
Is it with formula or Vba?
A formula like should be ok (you copy/paste this formula to every cells in your Col)
=IF(B1="",A1,B1)
In column C enter the following formula:
=IF(B1="", A1, B1)
Copy this formula down column C. Then, assuming it looks right, you may delete the current column B, leaving the new column to become the new column B.
It is important to note that this formula won't work if directly entered into column B. In that case, Excel would complain about a circular reference.
Highlight the entire column B used range and press Ctrl+F to open find and replace then insert select
find " " (leave blank)
replace =OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),,-1,1)
Which looks like:
Result:
This, INDIRECT(ADDRESS(ROW(), COLUMN()), refers to the cell itelf, and -1 column offset argument refers to column to left.
You can then do copy paste as values to convert formulas to hard coded values.

Identify minimum and maximum values based on 3 criteria

In the table shown, I need a formula for column D that will indicate the first date (minimum) and most recent date (maximum) that each participant (in column A) took survey A (in column C). Column D would need to indicate "first" and "last" tied to the Participant ID--for example, I would want D2 to populate with "3Last" and D5 to populate with "3First." Column E displays what I would need column D to display. If it's not a first or last date (something in between), or if it's not survey A, the cell in column D would be left blank or 0. If there is only one date that meets the criteria, it should return "First" rather than "Last." I'm pretty stumped on this one... Any help is much appreciated!
In E2, insert the ARRAY formula listed below. If you have never used an array formula, follow these steps:
select the formula from this page
copy it
go to excel
select cell E2,
press the 'F2' key
paste the formula
press CTRL+SHIFT+Enter (instead of just pressing enter)
To copy down, follow these steps:
Copy cell E2
Move down to cell E3 (instead of selecting a range)
Paste in cell E3
Select your range and paste from there.
If you don't copy down in this manner, it will tell you that you cannot change the array...
=IF($C2="A",IF($B2=MIN(IF(($C$2:$C$7=$C2)*($A$2:$A$7=$A2),$B$2:$B$7)),CONCATENATE($A2,"Last"),IF($B2=MAX(IF(($C$2:$C$7=$C2)*($A$2:$A$7=$A2),$B$2:$B$7)),CONCATENATE($A2,"First"))),0)
HTH

MS Excel: How do I make cell references variable?

I probably didn't word that title correctly, so let me explain what I'm trying to do.
I need to find cycles in a series of data. So let’s say I have all of my data in column A of an Excel spreadsheet. If a condition that I’m looking for is true in, say, cell A7, I want to check to check if it’s true in every second cell (A9, A11, A13 and so forth). If it’s not true in every second cell, I want to adjust the model to check every third cell starting with that A7 cell (A10, A13, A16, and so on). If the condition is not true in every third cell, then I want to check every fourth cell (A11, A15, A19, etc.).
Programming the formula to check if the condition is true should be somewhat easy using either IF or AND formulas. My problem is how do I change the model to switch from every second cell to every third cell, and then run it to check every fourth cell, and so on. I’d like to, say, set up the formulas in column B and have cell C1 be a user input that determines which cells are used in the formulas in column B. Is there a way to do this?
Example: if cell C1 says “2”, then the formulas in column B check every other cell in column A, and if I change the value in cell C1 from “2” to “3”, then the formulas in column B switch from checking every second cell to checking every third cell and report back to me.
I could just manually change the cell references in the formulas in column B, but that could take bloody ages and I figure there’s got to be a better way.
So I’m looking to make the cell references ‘variable’ in a sense. Instead of hardcoding the cell references and saying “look at cell A7, then look at cell A9, then look at cell A11…” I want to tell Excel “look at A7, then the next cell you look at is dependent upon what I say in cell C1.”
The image below shows my setup:
I have simple data in column A. Column B determines whether the formula in C should be evaluated. For example, B2 contains the following formula:
=IF(MOD(ROW(A2),$D$2)=0,1,0)
Column C would contain the logic you want to apply. In this case, I return the data in A if B is 1; otherwise, I return "":
=IF(B2=1,A2,"")
Column D determines the number of rows to skip.
If you want just one column, this formula would go in B1 and you can drag it down. Update the $A$1:$A$20 range to include your entire range. This formula will check whether the previous cell in your cycle (every 2,3,4,etc) matches.
=IF(AND(ROW()>$C$1,MOD(ROW(),$C$1)=0),INDEX($A$1:$A$20,ROW()-$C$1)=$A1,"")
Do not use INDIRECT...ever.

Formula in all cells in a column

Simple question:
I want to create a formula which, in column Cn, will compute the values of An * Bn.
example
column C1 = column A1 * column B1
column C2 = column A2 * column B2
column C3 = column A3 * column B3
...etc
all the way down to
column Cn = column An * column Bn
Thanks
Easy way to do it.
Highlight your formula cell.
The lower right corner should turn into a + sign.
Click on that + sign and drag it for as many rows as you like.
Alternatively, you can do this:
Highlight the formula cell.
Ctrl+C to copy.
Click on the C column.
Hit enter.
Now with the second method, it may start to lock up on you because of the large number of cells it has to compute. Just hit escape and it'll go back to normal (but some cells may not be filled in, depending on how early you hit escape.)
In what context are you trying to create a formula? If in VBA, you can do something like:
Range("A1").FormulaR1C1 = "=RC[-2]*RC[-1]"
This formula is in R1C1 format. It tells the system to take the value two columns to the left of the cell containing the formula and multiply it by the column to immediately to the left of the cell containing the formula. This same formula could be entered in all rows of column C and would automatically adjust based on the row.

Resources