Excel formula to get all values in one cell - excel

I want to copy all cells with values into one cell from a specific column, with everytime a CHAR(13) included in between them. This without VBA, just with excel formules.
example:
A | B
1 | test1
2 | test2
3 |
4 | test4
I want the output in one cell like this:
=B1 & CHAR(13) & B2 & CHAR(13) & B4
When you add that value as a source to a textbox, you'll get:
test1
test2
test4
Anyone have any ideas? This without VBA, only via formula's

Consider:
=TEXTJOIN(CHAR(10),TRUE,B1:B4)
Note the use of 10 rather than 13.

Related

I would like to prepend an ascending set of numbers to a row of text cells in Excel

So I have a row of cells that have questions
Blah | blah2 | blah3 ||| blah73
I'd like to make it so it looks like this
Q1: Blah | Q2: Blah2 |||| Q73: blah73
How do I do this in excel without having to do it manually?
In an empty row:
="Q" & Column(A:A) & " " & A1
Where A1 is the first cell in the row with Blah. You only need to change the A1 to the first cell and drag across

Formula to get cell values of specific column and a variable row number

I need a formula to retrieve a value defined by a specific column (always B) and a variable row number (A).
What is the formula I need to write in column C to retrieve the right names as shown below?
_A_____B_______C_____
3 | Lucas | Gary <--B3
_____________________
1 | Mark | Lucas <--B1
_____________________
2 | Gary | Mark <--B2
You want to use the INDIRECT function.
Column C should be:
=INDIRECT("B" & $A1)
=INDIRECT("B" & $A2)
=INDIRECT("B" & $A3)
(you can just enter the formula in the first cell and copy it down)

VBA/Excel: Get cell from different sheet

Long story short: I have two sheets in Excel: Sheet1 which has two cells (A1 & A2) and Sheet2 (providing some data) which looks like this:
| A | B |
--|---|----|
1 | a | 5 |
2 | b | 10 |
3 | c | 15 |
4 | ...
So here's my problem: in Sheet1 when I enter "b" in A1 it should automatically enter 10 in A2.
Kinda like a simple find operation which will return the cell (or column) number and use that to return the value for the cell right next to it. But how do I do this?
Thanks in advance!
As mentioned before, a VLOOKUP is the simplest and fastest way but I assume you do not want to have a formula in that cell or on that whole Sheet1 for that matter? Here is one simple way to do the same in VBA while still using a VLOOKUP - just not on Sheet1:
Use Sheet2!Z1 for calculation, if that cell is used in your workbook, just use any other unused cell in an area that is hidded for example.
Formula in Sheet2!Z1 :
=VLOOKUP(Sheet1!$A$1,Sheet2!$A$B,2,FALSE)
Simple VBA to populate Sheet1!A2:
sum DoIt
Worksheets("Sheet1").Range("A2").Value = Worksheets("Sheet2").Range("Z1").Value
end sub
You can call the DoIt sub with a button for example and it will keep your Sheet1 / cell A2 clean of formulas.

Need to match data in different sheets and replace data in another cell if it's a match

I need to match data in column A2 and so on in sheet 1 to data in column A2 and so on in sheet 2. If the data in column A of sheet 1 and sheet 2 match I need the data in column B & C of sheet 2 to replace data in column B & C of sheet 1. I know VERY little about doing this kind of stuff so any help would be GREATLY appreciated!
SHEET 1
A B C
2 12345 5.35 9.95
3 15874 4.22 10.99
4 11111 2.24 5.99
5 98745 5.33 9.95
6 88552 4.24 8.95
SHEET 2
A B C
2 11111 2.09 5.79
3 12345 5.11 9.89
4 88552 4.01 8.79
NEED SHEET 1 to change to
A B C
2 12345 5.11 9.89
3 15874 4.22 10.99
4 11111 2.09 5.79
5 98745 5.33 9.95
6 88552 4.01 8.79
On a third sheet use these functions
column a ='sheet1'!a2
column b =if('sheet1'!b2='sheet2'!b2,'sheet2'!b2,'sheet1'!b2)
column c =if('sheet1'!c2='sheet2'!c2,'sheet2'!c2,'sheet1'!c2)
Copy sheet3 and paste the values into sheet1.
This should work unless column a does match. or if you need to do this dynamically. If column a doesn't match some vlookups can be thrown in.
I your data does match in column a your formulas could look something like this.
column a ='sheet1'!a2
column b =if(not(iserror(vlookup(a2,'sheet2'!a:c,2,false))),vlookup(a2,'sheet2'!a:c,2,false),vlookup(a2,'sheet1'!a:c,2,false))
column c =if(not(iserror(vlookup(a2,'sheet2'!a:c,3,false))),vlookup(a2,'sheet2'!a:c,3,false),vlookup(a2,'sheet1'!a:c,3,false))
this is too much to put in a comment so I'm putting it in answer.
The way I under stand is, since sheet1 has more data, you only want to be doing this comparison when sheet1 and 2 both have data on the row. so If sheet1 has data in rows 1 - 100, and sheet2 has data in rows 1 to 50, you only want to be doing this comparison for the first 50 rows in sheet1 right?
So, rather than copying and pasting formulas, what you can do is, in sheet1, find an unused column. go to the first row. in the formula box, type: "=if(" without the quotes. now, select the first cell to compare, according to your example you'd select sheet1, A2. then type "=" without quotes. then select the second cell you want to compare - in your example, sheet2, A2. then type "," without quotes. then select the cell from which you want the data if the first 2 cells are equal. in your example, sheet2 B2. then type "," without quotes, then select the cell with the data to use if the first 2 cells are not equal. in your example, sheet1 b2. then type ")" without the quotes.
so using your example, the function would look similar to how bigtree had it: =if('sheet1'!A2='sheet2'!A2,'sheet2'!b2,'sheet1'!b2)
so, this will compare sheet1 cell A2 with sheet2 A2 and if they are equal, the cell you put the formula in will the have the value of sheet2 b2, and if they are not equal, the cell with this formula will have the value of sheet1 B2. then, drag this formula down for however many rows you want, and the formula will adjust automatically for each row. you'll see the numbers increase. then, select the column with the formulas, right click and select copy, then right click and go to paste special, and click values. this will make it so the column contains only the values, not the formulas, now you can paste this data in column B sheet 1.
you can reuse this formula for whatever columns, just follow the steps.
HTH, good luck!

Cell Value pickup from different sheet

I have 5 sheets in a workbook namely Sheet1, Sheet2, Sheet3.... Maintaining some data in each sheet. In first sheet namely Consolidation I need the B3 Cell value of each sheet to be displayed in each cell
Table in the Consolidation sheet will be as below
SheetNo| Name | value (Value of B3 Cell of respective sheet )
| |
1 | Party 1 | Value of Sheet1!B3
2 | Party 2 | Value of Sheet2!B3
3 | Party 3 | Value of Sheet3!B3
4 | Party 4 | Value of Sheet4!B3
:
:
N | Party N | Value of Sheetn!B3
:
:
:
Z | Party Z | Value of SheetZ!B3
I want this to be done most likely through some cell functions only not using VBA Scripting
go to your Consolidation sheet:
a1: 1, a2: 2, a3: 3 etc
a2: ="Party "&a1
a3: =INDIRECT("Sheet"&a1&"!b3")
auto fill rest
Unless I'm missing something haven't you sort of already answered it with your example?
=SheetName!Address will return the value of Address on SheetName
If you wanted it a little more dynamic so you dont have to manually fill the sheet name, you could do something like this.
=INDIRECT("Sheet" & Row() & "!$B$3")
However it will only do numeric sheet names. (unless N and Z are just numbers then theres no problem)
Just looked and saw that you've got the sheet number next in Column A so you can substitue Row() for $A$1
To refer to a cell by name, you can use the INDIRECT() function, as in:
=INDIRECT("'"&$B1&"'!$B$3")
Here, B1 is the cell containing the name of your sheet. The expression inside the parentheses will evaluate to, for example, 'Party 1'!$B$3. INDIRECT() will expand that to the actual value of cell B3 in sheet Party 1.
The extra single-quotes are required to deal with the spaces in your sheet names.

Resources