I would like to prepend an ascending set of numbers to a row of text cells in Excel - 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

Related

Excel formula to get all values in one cell

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.

How to use vlookup if lookup value contains multiple values in single cell

Suppose Sheet1 has the following table ( data range Cell A1 to B4)
Fruits | Colors
======= | =======
Apple | Red
Mango | Green
Banana | Yellow
Suppose in sheet2, Cell A1 has following values ( Apple Mango Banana) separated based on space.
How to use VLookup in Cell B2 based on A1 value which can give you the results in the same order ( Red Green Yellow)
This formula in Sheet2!B2 does it:
=INDEX(sheet1!B:B,MATCH(TRIM(LEFT(SUBSTITUTE(A1, " ", REPT(" ", 100)),25)),sheet1!A:A,0)) & " " &
INDEX(sheet1!B:B,MATCH(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),100,25)),sheet1!A:A,0)) & " " &
INDEX(sheet1!B:B,MATCH(TRIM(RIGHT(SUBSTITUTE(A1, " ", REPT(" ", 100)),25)),sheet1!A:A,0))
This formula works fine when you have 3 values to match (in case there are 2 only, the second one will be repeated). It can be further complicated to treat any number of values.
Of course it can be simpler in VBA using the Split function, and it would take into account any number of keys, yielding the joined values. You can use this in a macro:
Sheet2.Range("B1").value = Join(Application.index(Sheet1.Columns("B"), _
Application.match(Split(Sheet2.Range("A1")), Sheet1.Columns("A"), 0)), " ")
Of course you can adjust it to any cell in column B, using Range("B" & i) and Range("A" & i)...

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.

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