Excel - How to fix letter - excel

I have a column B with numbers and I want my row 2 to be 1-B3, 1-B4, 1-B5 and so forth.
If I type in =1-B3 and extend it to the right it becomes 1-C3, 1-D3 and so forth.
If I type in =1=$B3 and extend it to the right it just stays 1-B3.
How do I lock the letter B so that only the number will increase when I extent it to the right?

Yeah. So you can't do that in a single, manual copy or range extension.
You could (as JvdV suggested) write a more complex formula, that will transpose on copy/extend. But I'm not sure if that's what you're trying to learn.
You could also write vb to automate the construction your formula. Again though, I'm pretty sure that's also not what you're asking.
Assuming you're just looking for a simple manual solution to what you're trying to do:
Enter the formula =1=$B3 in a cell in any EMPTY column
Doesn't matter where that cell is
Copy/extend that cell down the COLUMN to match all your column B values
Select the entire suite and Copy
Select the target starting cell, in your target row
Right Click >> Paste Special
Select Paste Formulas and Check Transpose >> Click Ok
You can now of course delete the 'temporary' column of formula

Related

Change part of excel formula with a constant value

I have an excel formula across a column for which the base changes every "x" number of rows. Note this "x" is not constant and keeps changing. e.g.
=D1/SUM(D$1:D$4)
=D2/SUM(D$1:D$4)
=D3/SUM(D$1:D$4)
=D4/SUM(D$1:D$4)
=D5/SUM(D$5:D$9)
=D6/SUM(D$5:D$9)
=D7/SUM(D$5:D$9)
=D8/SUM(D$5:D$9)
=D9/SUM(D$5:D$9)
I am trying to change the first part of the formulas without changing the second and vice versa. e.g. changing the numerator by 10 cells.
=D11/SUM(D$1:D$4)
=D12/SUM(D$1:D$4)
=D13/SUM(D$1:D$4)
=D14/SUM(D$1:D$4)
=D15/SUM(D$5:D$9)
=D16/SUM(D$5:D$9)
=D17/SUM(D$5:D$9)
=D18/SUM(D$5:D$9)
=D19/SUM(D$5:D$9)
or, changing the base by 100. e.g.
=D1/SUM(D$100:D$104)
=D2/SUM(D$100:D$104)
=D3/SUM(D$100:D$104)
=D4/SUM(D$100:D$104)
=D5/SUM(D$105:D$109)
=D6/SUM(D$105:D$109)
=D7/SUM(D$105:D$109)
=D8/SUM(D$105:D$109)
=D9/SUM(D$105:D$109)
Sometimes, both. Any guidance on how this can be possible?
Thank you.
the first part of this problem seems easy unless I am missing something?
Part 1:
Since the denominator is already in $x form, you can select and COPY the whole range of formulas and PASTE them 10 rows down and then CUT and paste it back into position. The COPY will update the numerators appropriately and when you CUT and PASTE it back into position they will now be just as you want? The second question will be a bit more of a challenge!
Part 2:
OK without VBA I can only think of a really long-winded way to change your demoninators, but I just checked that it does work:
To change the bottom.
Search and replace = with '=
Now you can edit the formulas more freely.
Search and replace D with D%
Search and replace D%$ with D
Search and replace D% with D$
get rid of the '= by using the Data>text to columns option
Now use the copy and paste, cut paste trick from part 1.
Then if you still need your $s back as they were you essentially repeat 1 to 5 again.
Sorry, this looks really long-winded, but if you are desperate and back up before you start it should work.
An excel formula can't replace another cells excel formula... One approach is to make the formula into text and then transform it by other formulas. When transformation is done, you could paste the formula back.
So for changing the D1 -> D11, I would build a dummy series (column K) then write a formula (cell L1). Then I can copy the formula and paste it into the correct column.
Replaceing the "=", with a special character and then you can transform the formulas.
(Column F).
In Column I, the formula used is: =RIGHT(F1,LEN(F1)-FIND("/",F1))
For changing D$1 -> D$100, I think I just would copy and replace it by searching in "Formulas".
This approach can be feasible for acouple of hundred cells. If the list is very long, I would recommend some VBA solution, where you can grab a cells formula with .Range("A1").Formula

Read value on Sheet1 from Sheet2 using vlookup

I have the following on Sheet1:
Then on Sheet2, I have data. Following is the image.
I want to read the today's and tomorrow's for all the fruits from Sheet2 to Sheet1
I tried vlookup, but it didn't give me a right answer. It was confusing. I also tried to incorporate an if statement with the vlookup, but that made it more confusing.
If you data is consistent, you can use this formula =IF(C$2="Today",INDEX(Sheet2!$D$3:$D$800,MATCH($B3,Sheet2!$B$3:$B$800,0)),INDEX(Sheet2!$D$3:$D$800,MATCH($B3,Sheet2!$B$3:$B$800,0)+1)) in cell C3. drag formula below whole table...
Maybe there is way to match with blank cells in between, but the best practice is to fill out those blanks to save your time and make the formula clean, moreover, it is very easy with this trick:
First, highlight the column (ie. B1 to B6), and then go Home > Editing > Find & Select > Go To Special > Blanks > OK, =, upper arrow key, Ctrl + Enter. This way it will fill out all the blanks with the most available text in it.
Then you can perform this easy formula to do the subtotal task:
=SUMIFS($I$3:$I$13,$G$3:$G$13,$B3,$H$3:$H$13,C$2)
Please note that I put everything in the same tab to show you how this is being done. You should change those ranges accordingly based on your data setup. This way, you can have more data and different criteria be added on and still get the correct answer as I have shown you in the above screenshot.

How to transpose Columns to rows (with interruptions) in Excel?

Suppose that we have two columns including a million rows
like this:
What is the right formula or VBA to make another arranged table like this?
For a pure Excel solution try this.
First you need to add a helper column. This just returns TRUE on a header row or FALSE otherwise. This isn't strictly necessary, but it will make the rest of the formulas a little simpler. In the sample you provided above, type this into cell C1:
=IF(A1=B1,TRUE,FALSE)
Now enter this is cell D1:
=IF(AND(C1,NOT(C2)),A2,"")
What this does is check if the current row is a header but not the next, and copies the first cell of the next row if it is, or returns a blank string if it isn't.
Each subsequent cell follows the same pattern, but it first checks if the previous cell is blank. Enter this function into cell E1:
=IF(D1="","",IF(AND(C1,NOT(C3)),A3,""))
Now you just need to copy this pattern outfor another 10 cells. Unfortunately copy-and-paste won't work as you need to increment A3 and C3 downwards, while copy-and-paste with increment them to the right. So, from E1, we get:
F1: =IF(E1="","",IF(AND(C1,NOT(C4)),A4,""))
G1: =IF(F1="","",IF(AND(C1,NOT(C5)),A5,""))
.
.
.
O1: =IF(N1="","",IF(AND(C1,NOT(C13)),A13,""))
Now copy those cells to the bottom of the data set and you should get the results you're after. Here's an example:
Note the extra TRUE in cell C21 so that the last calculation terminates correctly.
However, if you really have a million rows in your data set, I would question the wisdom of using Excel at all. Depending on your circumstances and resources, you may be better off keeping the data in a text file and processing it with a proper scripting language.
Problem Solved in excelforum by JohnTopley here:
http://www.excelforum.com/excel-formulas-and-functions/1174447-interrupted-transpose.html

Change variable horizontally in excel formula

I want to change a variable in an excel formula horizontally and maintain one variable constant.
O3/$C18, P3/$C18, Q3/$C18
I can keep the the bottom variable constant by using the $ symbol but when I want to extend the formula to additional cells, the top variable does not change horizontally, rather vertically.
Thank you for your help. Cheers
The dollar signs in excel "fix" the item to their right
$C18
means C will always be fixed, and 18 can change
C$18 means C can change, but 18 is always fixed.
$C$18 means C is fixed and 18 is fixed (ie always use C18 no matter what direction you drag the cell)
I dont fully understand what you want to do but hopefully the above will help
based on the comments below i think i understand what you mean
try a formula like this
=INDIRECT(ADDRESS(1,ROW()))/$C$18
here address takes the row and column, so row = 1 and column = which ever row you are on (so row1 = A, row2=B etc)
then indirect lets you use that as a reference point
Hope that works
If I understand you correctly, you want to copy your formula vertically, but have the columns update as if you were copying horizontally. For example, you want to copy =O3 to the cell below it as =P3.
For the top, consider the Offset() and Row() functions. Let's say that Cells A1,B1,C1 are 1,2, and 3. Try =OFFSET($A$1,0,ROW()-1). If you copy that formula vertically, the result will be 1, then 2, then 3.
So in your case, try =OFFSET($O$3,0,ROW()-1). It probably needs a little adjustment.
Here's another way to do this:
Start with the formula in this form:
=O$3/$P$18
Copy and paste it across so that you get:
=O$3/$P$18 =P$3/$P$18 =Q$3/$P$18
Copy the two formulas you pasted and select the cell below the first formula.
Then do a Paste Special / Transpose, which can be accessed by right-clicking the selected cell (that is, the one below the first formula that you entered) and then choosing the button that shows a little two-cell range flat and then upright.
Finish up by deleting the formulas in the cells you just copied from.

In Excel how to get the left 5 characters of each cell in a specified column and put them into a new column

I want to take the left 5 characters of each cell in column E and put them into the adjoining cell in column F:
A...B....C...D......E..................F
123.bb...cc..dd.....90210ABCE13........90210
555.bb...cc..dd.....10056Z19s..........10056
Using Left(x, 5) function, how does Excel say "do this to every cell in the specified column"?
1) Put =Left(E1,5) in F1
2) Copy F1, then select entire F column and paste.
I find, if the data is imported, you may need to use the trim command on top of it, to get your details.
=LEFT(TRIM(B2),8)
In my case, I was using it to find a IP range. 10.3.44.44 with mask 255.255.255.0, so response is: 10.3.44
Kind of handy.
Have you tried using the "auto-fill" in Excel?
If you have an entire column of items you put the formula in the first cell, make sure you get the result you desire and then you can do the copy/paste, or use auto fill which is an option that sits on the bottom right corner of the cell.
You go to that corner in the cell and once your cursor changes to a "+", you can double-click on it and it should populate all the way down to the last entry (as long as there are no populated cells, that is).

Resources