Keep cell reference when dragging down - excel-formula

Column A: Cost of an apple
Column B: Quantity of apples purchased
Column C: Total cost of apples purchased
Cell A2: $1.50
Cell B2: 3
Cell B3: 10
Cell B4: 15
C2 currently has the formula =A2*B2. How would I tweak the formula, so that when I drag down the formula to cells C3 and C4, A2 stays the same?

To keep a specific cell reference value, use a $ in front of the cell and row reference, so to the formula, that would be: $A$2*B2

Related

count row and make max permutation

How can I make permutation of name list? For ex. I have 5 names on A column. Firstly count A column and give me only permutations 5 ly to b column in cell with separete "," changing only the first names...
Column A
tom
Lila
John
sam
steave
Column B
Tom,Lila,John,Sam,Steave
Lila,Tom,John,Sam,Steave
John,Tom,Lila,Sam,Steave
Sam,Tom,Lila,John,Steave
Steave,Tom,Lila,John,Sam
This is a fairly simple one:
In Cell B1 enter this formula: =A1&","&A2&","&A3&","&A4&","&A5
This will build a string from all cell values with a , in between them.
Then in B2 enter this formula: =A2&","&SUBSTITUTE($B$1,","&A2,"") and drag down.
It will start with the value of cell A2, add a comma and then add the string from cell B1 in which it substitutes the value in cell A2 with ""(no character), effectively removing it from the string.
Edit as per comment from OP
(Adapt range A1:A10 as needed)
To make this responsive I have added a helper column.
In column B I now have a helper column with the following formula:
In B1: =IF(A1<>"",A1,"")
In B2: =IF(A2<>"",B1&","&A2,"") drag this down.
In cell C1 I have this Formula: =IF(A1<>"",INDEX(A1:A10,COUNTA(A1:A10)),"") This will put the longest string of data into the cell.
In C2 then the original formula, wrapped with an IF to account for empty cells, can be inputted: =IF(A2<>"",A2&","&SUBSTITUTE($B$1,","&A2,""),"")
This are then the results:

How to change cell value according to sum

I want to change cell value according to my sum means if i give total 2000 in "A5" than value change automatic in cell range A1 to A4.
It's confusing to answer your question without knowing more.
Assuming you are working in Excel, if you have the following numbers
A1 A2 A3 A4 A5
5 6 7 8 1000
you can set the following formula for A1, A2, etc.
=IF($A$5=2000,*value that you want cells to read, "")
Essentially if the condition on cell A5 is met, in this case reaching 2000, you will change the value of cell A1 - A4 to a specified amount. If it doesn't reach 2000, you will keep the original value.
You could have formulas in A1 to A4 as percentages of A5,
for example,
A1: =0.1*A5
A2: =0.2*A5
A3: =0.3*A5
A4: =0.4*A5

Sub a number with column numbers and show the results in a row

I have a number in cell B2 and I want to make a sub this number with each number in the column C.
The results will be presented in a row (and I want to use the cross in the right corner of the cell to autofill).
Let me explain you what I want to show in each cell:
E2: $B$2-C5
F2: $B$2-C6
G2: $B$2-C7
In order not to write it manually in each cell, how can I change it (autocomplete C5, C6, C7) with the usage of the cross?
I tried to use the dollar like $B$2-$C5 and then drag the cross but it fills all the cells with the C5 value and not C6, C7 etc
In E2 enter:
=$B$2-INDEX($C:$C,COLUMNS($A:E))
and copy across:

Split one column by rows to multiple columns in Excel

I am working in Excel 2013, and I have data like the following:
A1
A2
A3
B1
B2
B3
(The As go to A13, Bs go to B13, Cs go to C13, and so on until you get to row 2495.)
How do I divide this long column where the 14th row moves to the next column? See below:
A1 B1 C1 ...and so on
A2 B2 C2
A3 B3 C3
...
A13 B13 C13
B1: =INDEX($A:$A,(COLUMNS($A:A)-1)*13+ROWS($1:1))
Fill right to AA1
Select B1:AA1 and fill down to row 13
The above assumes you are going A-Z. But you must have other characters also in order to get to 2495 rows. Your real data may require some tweaks from what I have presented -- either filling down further; or filling further to the right, or using a different constant then 13
If you want to parse the data into three separate columns then in B1 enter:
=A1
In C1 enter:
=A14
In D1 enter:
=A27
Then copy these three cells downwards:

Cell address defined by the contents of other cells

How do you define variable cell address in Excel. For example consider the case where the content of cell A1 is 5, cell A2 is 2, cell A3 is 10 and cell A4 is 1. How do I enter a general formula to SUM the content of the cells A7 (A1+A2) through A9 (A3-A4)? I would then like to drag the formula to columns B through CJ,... and repeat similar calculations noting that values of B1 through CJ4 are different than A1 through A4. I appreciate any suggestions.
=SUM(INDEX(A:A,A1+A2,1):INDEX(A:A,A3-A4))

Resources