I've been trying to use AVERAGE with INDIRECT but keeps giving me errors.
Now I am using Average like this:
AVERAGE(Results!C2:C51)
I need to get data from another sheet "Results". But in my current sheet I got the range of the rows set in two cells.
+-------------------+
| ... E F |
| +-------+-------+
| 2 |...| 2 | 51| |
| +---------------+
| 3 | | 52|101| |
| +---------------+
| 4 | | | | |
+---+---+---+---+---+
I've tried like this, but it's not working:
AVERAGE(Results!INDIRECT("C"&E2):INDIRECT("C"&F2))
This should do it:
=AVERAGE(INDIRECT("Results!C"&E2&":C"&F2))
The answer posted by zipa is correct. Here is an alternaive that will allow you to avoid INDIRECT() entirely:
=AVERAGE(INDEX(Results!C:C,E2):INDEX(Results!C:C,F2))
This is based on Scott Craner's Answer to a question I asked previously.
Related
I am working on a excel like this
I would like to create a condition from second table using matches between two tables columns values (Tool and tools) to automatically replace the column Unit prince
I want this result
<table>
| Tool | United Price |
| : ---|:------------:|
| Axe | 5,9 |
| : ---|:------------:|
| Axe | 5,9 |
| : ---|:------------:|
| Hoe | 9,1 |
| : ---|:------------:|
| Drill| 7,8 |
| : ---|:------------:|
| Hoe | 9,1 |
| : ---|:------------:|
| Hoe | 9,1 |
| : ---|:------------:|
| Drill| 7,8 |
</table>
I tried to use VLOOKUP(A2; E2:F4; 2; FALSE), but it's don't work
I think you want to use a Lookup function in the United Price cells. I’d suggest making both of them tables. From the image it just looks like loose cells but with tables you can use structured references to make the formulas cleaner and easier to maintain.
Try:
=VLOOKUP(A2; $E$2:$F$4; 2; FALSE)
This will fix the position of the lookup array.
Assume i have a table like this,
table: qa_list
id | question_id | question | answer |
---------+--------------+------------+-------------
1 | 100 | question1 | answer |
2 | 101 | question2 | answer |
3 | 102 | question3 | answer |
4 | ...
... | ...
and a query that gives below result (since I couldn't find a direct way to transpose the table),
table: qa_map
id | qa_map
--------+---------
1 | {question1=answer,question2=answer,question3=answer, ....}
Where qa_map is the result of a map_agg of arbitrary number of questions and answers.
Is there a way to UNNEST qa_map to an arbitrary number of columns as shown below?
id | Question_1 | Answer_1 | Question_2 | Answer_2 | Question_3 | ....
---------+-------------+-----------+-------------+-----------+-------------+
1 | question | answer | question | answer | question | ....
AWS Athena/Presto-0.172
No, there is no way to write a query that results in different number of columns depending on the data. The columns must be known before query execution starts. The map you have is as close as you are going to get.
If you include your motivation for wanting to do this there may be other ways we can help you achieve your end goal.
I have two sheets inside Excel like this:
*Sheet 1*
| 20 | | |
|----|---|---|
| 21 | | |
| 22 | | |
| 23 | | |
*Sheet 2*
| Referenz | |
|----------|---|
| 21 | |
| | |
| 22 | |
| | |
| 23 | |
I would like the output in sheet 2 as shown. Now I tried leaving space between the cells by dragging it down, but it doesn't work as expected. I also had a look at INDEX but it is not what I'm looking for.
Can you please help me?
Assuming your data is in cells A2:A4 on the first sheet and you want the output on second sheet starting from second row, you can try following formula in sheet 2 row 2:
=IF(ISEVEN(ROW()),INDEX(Sheet1!$A$2:$A$4,CEILING(ROW()/2,1)),"")
Edit:
If I have understood what you need correctly then you can use a formula like
=Sheet1!A2&CHAR(10)
Copy down...!
Try this:
=IF(ISEVEN(ROW());A2+1;"")
Should give you the following result:
In case you want the rows that are uneven, just switch the "value_if_true" and "value_if_false" of the IF() formula.
I have a very somewhat complicated question (at least to me ) and I'm hoping someone will be kind enough to help. I hope my explanation is good enough
I have a mapping table like below, we have multiple elements b mapped to element a
| Element a |Element b|
|---------------|-------- |
| B10 | 212010 |
| B101 | 212010 |
| B102 | 212010 |
| B103 | 212010 |
| B104 | 212010 |
| B301 | 111030 |
| B302 | 111030 |
| B303 | 111030 |
| B304 | 111030 |
|---------------|-------- |
Each element in the above table will have a value in another table:
| Element A | Value |
|-----------|-------------|
| B10 | 1,000.00 |
| B101 | 2,000.00 |
| B102 | 6,000.00 |
| B103 | 1,000.00 |
| B104 | 10,000.00 |
| B301 | 1,000.00 |
| B302 | 2,000.00 |
| B303 | 6,000.00 |
| B304 | 1,000.00 |
|-----------|-------------|
| Element B | Value |
|-----------|-------------|
| 212010 | 20,000.00 |
| 111030 | 10,000.00 |
|-----------|-------------|
I have to compare the value of the corresponding elements above using the mapping table, I'm looking for a solution that looks like the table below -
Steps:
Compare the value of each element side by side without duplicating element b
if possible put a box around each mapped element and value
I understand it may only be possible to the above using only VBA macros, but a similar solution using only excel formula will be very appreciated.
The solution should be compatible with Excel 2003.
Thank you very much
Insert a column after element a and insert formula:
=VLOOKUP(A2;$F$2:$G$7;2;FALSE)
$F$2:$G$7 should refer to the sheet/range of your values
the column after element b should contain the formula:
=IF(C2<>C1;VLOOKUP(C2;$F$2:$G$7;2;FALSE);"")
Then put a conditional format in for the border based on the cell in d column being empty or not.
Go to conditional formating and select "use formula"
type in formula:
$D2<>""
And select the tab border to select top border.
I would do this by sql query in excel if you have these tables in different sheets you can join them.
In sql after select statement you can type Distinct and this will delete the duplicates.
This is a general question that just popped into my head that I have always wondered. There have been several times when I've needed to rotate data in Excel, for example:
Starting with:
| A | B | C |
----------------------
1 | ABC | DEF | GHI |
----------------------
2 | omg | lol | xyz |
----------------------
3 | | | |
----------------------
transform into:
| A | B | C |
----------------------
1 | ABC | omg | |
----------------------
2 | DEF | lol | |
----------------------
3 | GHI | xyz | |
----------------------
I have never found a reasonable way to do this. Solutions I can think of right now are:
Write a macro (yuck)
Manually copy / paste (yuck)
Maybe some pivot table magic? (i doubt this would be possible)
Clever formulas using INDEX
Are there other solutions, maybe some hidden built-in feature?
Copy your grid
Edit ▸ Paste Special...
Check the "Transpose" checkbox
Click "OK"
Use of the TRANSPOSE() function
Transposing rows and columns?
See:
http://office.microsoft.com/en-us/excel-help/rotate-data-by-converting-columns-to-rows-or-vice-versa-HP005203138.aspx
Construct a pivot table from the data then you can transpose and do a lot more besides (filter, group etc)