Formula on Cell changes when I drag it down in excel - excel

I have a formula which goes like the one below
=COUNTIF(D10:D1000,Q13)
But everytime I drag it down D10 becomes D11. All I want to change is Q13 to Q14 to Q15 and so on but not the D10. So the above formula is for Q13 and in Q14 I want the formula to be
=COUNTIF(D10:D1000,Q14)
And for Q15
=COUNTIF(D10:D1000,Q15)
Notice that D10 doesn't change but Q+value does.
Kindly advice, Thanks.

Lock the range. This can be done by adding dollar signs before the references (or pressing F4 after typing/selecting the range:
=COUNTIF($D$10:$D$1000,Q13)
Though in this situation locking the row should be enough, since you're dragging down, the D won't change (you can add the dollar signs where required, or press F4 repeatedly until you get the right lock):
=COUNTIF(D$10:D$1000,Q13)

If you want D10 to stay the same specify an absolute reference using $, like this:
=COUNTIF($D$10:D1000,Q13)

Related

Write duplicate numbers down the page in numerical order. (Image may make more sense.)

Sorry if this is a basic question, still trying to learn. Is there any way I can have duplicate numerical numbers going down the page. Rather than having to manually type each number down twice, I was wondering if there is a formula/tool where I could drag down.
Thank you for your time and help.
Example:
Try following formula
=ROUNDUP(ROW()/2,0)
Starting with a number in A1, put =A1 in the A2 and then =A2+1 in A3. Then select A2-A3 and drag down.
Enter the start number in the first cell (say, 1). Enter the formula below in the cell underneath it.
=A2+MOD(ROW()+MOD(ROW(A$2)-1,2),2)
Replace both references to A2 with the address of the cell in which you wrote the start number. Press Ctl+C (Copy).
On the Ribbon's Home tab click Find & Select > Go To ... In the Reference field enter the range you want to copy to (presuming that it's a large range that takes too long to select). and press OK. That selects the target range. Press Enter to complete the pasting.
In cell A1 enter this formula and then copy down as far as you need...
=ROUND(ROW()/2,)

Excel drag-formula not working

I have a "subscription" column in column A. A1 is "12000". I want C1 to be "A1/12" AND D1 to be "A1/12". However, if I make the formula for C1 "A1/12" and then drag to the right, D1 will try to become "B1/12" which I DO NOT WANT.
I do not just want to make A1 a constant, because I want that when I copy and paste this onto the following rows, C2 and D2 should be "A2/12" and NOT "A1/12".
Thoughts? Sorry for the obfuscated explanation.
Just lock the cell. This is done with dollar signs, or when you put the reference, press F4.
=$A$1/12
And you can drag it without the formula changing the A1.
If you want it to change with changing rows, just lock the column A:
=$A1/12
Use the dollar sign to fix the reference:
=$A$1/12
You might want to have a look at this for more information
http://www.notjustnumbers.co.uk/2011/05/excel-tip-dollar-sign-in-formula-fixing.html

Prevent cell numbers from incrementing in a formula in Excel

I have a formula in Excel that needs to be run on several rows of a column based on the numbers in that row divided by one constant. When I copy that formula and apply it to every cell in the range, all of the cell numbers increment with the row, including the constant. So:
B1=127
C4='=IF(B4<>"",B4/B1,"")'
If I copy cell C4 and paste it down column C, the formula becomes
=IF(B5<>"",B5/B2,"")
=IF(B6<>"",B6/B3,"")
etc.
when what I need it to be is
=IF(B5<>"",B5/B1,"")
=IF(B6<>"",B6/B1,"")
etc.
Is there a simple way to prevent the expression from incrementing?
There is something called 'locked reference' in excel which you can use for this, and you use $ symbols to lock a range. For your example, you would use:
=IF(B4<>"",B4/B$1,"")
This locks the 1 in B1 so that when you copy it to rows below, 1 will remain the same.
If you use $B$1, the range will not change when you copy it down a row or across a column.
In Excel 2013 and resent versions, you can use F2 and F4 to speed things up when you want to toggle the lock.
About the keys:
F2 - With a cell selected, it places the cell in formula edit mode.
F4 - Toggles the cell reference lock (the $ signs).
Example scenario with 'A4'.
Pressing F4 will convert 'A4' into '$A$4'
Pressing F4 again converts '$A$4' into 'A$4'
Pressing F4 again converts 'A$4' into '$A4'
Pressing F4 again converts '$A4' back to the original 'A4'
How To:
In Excel, select a cell with a formula and hit F2 to enter formula
edit mode. You can also perform these next steps directly in the
Formula bar. (Issue with F2 ? Double check that 'F Lock' is on)
If the formula has one cell reference;
Hit F4 as needed and the single cell reference will toggle.
If the forumla has more than one cell reference, hitting F4 (without highlighting anything) will toggle the last cell reference in the formula.
If the formula has more than one cell reference and you want to change them all;
You can use your mouse to highlight the entire formula or you can use the following keyboard shortcuts;
Hit End key (If needed. Cursor is at end by default)
Hit Ctrl + Shift + Home keys to highlight the entire formula
Hit F4 as needed
If the formula has more than one cell reference and you only want to edit specific ones;
Highlight the specific values with your mouse or keyboard ( Shift and arrow keys) and then hit F4 as needed.
Notes:
These notes are based on my observations while I was looking into this for one of my own projects.
It only works on one cell formula at a time.
Hitting F4 without selecting anything will update the locking on the last cell reference in the formula.
Hitting F4 when you have mixed locking in the formula will convert everything to the same thing. Example two different cell references like '$A4' and 'A$4' will both become 'A4'. This is nice because it can prevent a lot of second guessing and cleanup.
Ctrl+A does not work in the formula editor but you can hit the End key and then Ctrl + Shift + Home to highlight the entire formula. Hitting
Home and then Ctrl + Shift + End.
OS and Hardware manufactures have many different keyboard bindings for the Function (F Lock) keys so F2 and F4 may do different things. As an example, some users may have to hold down you 'F Lock' key on some laptops.
'DrStrangepork' commented about F4 actually closes Excel which can be true but it depends on what you last selected. Excel changes the behavior of F4 depending
on the current state of Excel. If you have the cell selected and are
in formula edit mode (F2), F4 will toggle cell reference locking as Alexandre had originally suggested. While playing with this, I've had F4 do at least 5 different things. I view F4 in Excel as an all purpose function key that behaves something like this; "As an Excel user, given my last action, automate or repeat logical next step for me".
TL:DR
row lock = A$5
column lock = $A5
Both = $A$5
Below are examples of how to use the Excel lock reference $ when creating your formulas
To prevent increments when moving from one row to another put the $ after the column letter and before the row number. e.g. A$5
To prevent increments when moving from one column to another put the $ before the row number. e.g. $A5
To prevent increments when moving from one column to another or from one row to another put the $ before the row number and before the column letter. e.g. $A$5
Using the lock reference will prevent increments when dragging cells over to duplicate calculations.
Highlight "B1" and press F4. This will lock the cell.
Now you can drag it around and it will not change. The principle is simple. It adds a dollar sign before both coordinates. A dollar sign in front of a coordinate will lock it when you copy the formula around. You can have partially locked coordinates and fully locked coordinates.

Multiplying all values in a column in Excel by a number

I want to multiply all the cells from B5 onwards by D2, and put the results from C5 onwards. How would I do this in Excel using a formula? Sorry if this is off topic, but this has been bugging me for a while.
Write a separate cell with say "5". Copy this cell.
Select the column to multiply and right click -> Paste Special -> Paste Special.
Under operations, choose multiply.
Note: You can also choose just a selection, if wanted.
So in your case:
Copy D2
Select B5 to your MAX
Paste Special -> Multiply
Should look correct
You could use your B data and change C to be a formula "=B5*$D$2".
Then drag that down and D2 should stay the same, while B5 becomes B6 and so on.
The results should be correct to your specification.
I hope this helped!
If I get 2 more rep--I can post you a picture of it.
To multiply using a formula, use the $D$2 reference to your multiplier to lock in the cell d2
This tip Emeria mentioned is exactly the way to do it. Keep in mind that you can set the $ on the Row (i.e. D$2) or the Column ($D2) or both ($D$2) and then when you drag using the little square in a selection down, the NON-$ range reference will increment, but the one with the $ will not.
google "locking a range reference excel"
hope this helps if so please vote me up I'm trying to get some points!

Excel: OFFSET Formula in Name Manager

I defined names for frequently used formulas like below:
pointer =DataSheet!$A$1
sh1X0 =OFFSET(DataSheet!C7,0,0,DataSheet!pointer+1,1)
sh1X0 =OFFSET(DataSheet!F7,0,0,DataSheet!pointer+1,1)
I close the Name Manager.
I am using them to make chart series.
Everything works fine.
So far the active cell is B4.
I select a different cell, say B5, all the offset formulas are changing (getting corrupted) relative to the selected range.
The above mentioned formulas change to:
sh1X0 =OFFSET(DataSheet!C8,0,0,DataSheet!pointer+1,1)
sh1X0 =OFFSET(DataSheet!F8,0,0,DataSheet!pointer+1,1)
If C5 is the selection, then
sh1X0 =OFFSET(DataSheet!D8,0,0,DataSheet!pointer+1,1)
sh1X0 =OFFSET(DataSheet!G8,0,0,DataSheet!pointer+1,1)
Why are the formulas changing?
How can they be kept independent from the selection of the cell?
As you said, your formulas are relative. You need to make them absolute by using dollar signs, e.g.:
sh1X0 =OFFSET(DataSheet!$C$7,0,0,DataSheet!pointer+1,1)
Note that you can select the C7 part and hit F4 a couple of times to get the dollar signs right.
This Jan Karel Pieterse page has an explanation of absolute and relative references in defined names.

Resources