Store column name in an extra cell - excel-formula

By now, I use something like =function(tablename[[Columnname]:[Columnname]]). Is there an (easy) way to store Columnname in cell X1 and use something like =function(tablename[[X1]:[X1]])
My table named tablename:
ColumnA ColumnB
1 a
2 b
3 c
4 d
Cell A1 = ColumnA <-the string
Cell B1 = =COUNTA(tablename[[ColumnA]:[ColumnA]])
Cell A2 = ColumnB <-the string
Cell B2 = =COUNTA(tablename[[ColumnB]:[ColumnB]])
My aim is that the formulas in B1 and B2 use the values in A1 and A2.
What I tried yet is something like: =COUNTA(tablename[[INDIRECT(A1)]:[INDIRECT(A1)]])

The INDIRECT function converts a text string to a usable cell reference or in your case a structured (list object) table name.
=VLOOKUP(K3, INDIRECT(J3), 3, FALSE)
In my sample worksheet illustrated above, J3 is a Data Validation List with a source of AA2:AA3. K3 is a typed value and L3 contains the formula. If J3 is switched to Table1 then L3 becomes 66.

Related

Making Excel list more clearer to see the difference between the cells

In my list in Excel I have in Column A following data:
Cell A1 = GG-10000
Cell A2 = GG-10000
Cell A3 = GG-10005
Cell A5 = GG-10047
cell A6 = GG-10047
Cell A7 = GG-10047
Cell A8 = GG-10050
Cell A9 = GG-10050
Cell A10 = GG-10100
and so one...
Can someone tell me how to bold the lines as below
cell A1 = GG-10000 (this need to be in bold)
Cell A2 = GG-10000 (this need to be in bold)
Cell A3 = GG-10005
Cell A5 = GG-10047(this need to be in bold)
Cell A6 = GG-10047(this need to be in bold)
Cell A7 = GG-10047(this need to be in bold)
Cell A8 = GG-10050
Cell A9 = GG-10050
Cell A10 = GG-10100(this need to be in bold)
So the idea is that I can see the difference between the different numbers.
Many thanks
Robin
You can use conditional formatting.
If you have Office 365 Excel you can use this formula:
=ISODD(MATCH(A1,UNIQUE(FILTER(A:A,A:A<>"")),0))
UNIQUE => a list of the unique entries
MATCH => position of each individual entry in the unique list
ISODD => returns alternating boolean when the entry changes
If you don't have these Excel O365 functions, I'd suggest you develop a VBA routine or use a helper column to do something similar.
Here's an example of a "helper column"
I'll use column B, but you can use any column anywhere; and you can hide it.
B1: 1
B2: =IF(A2=A1,B1,-B1) and fill down
Conditional Format formula:
=B1=1
Since the CF Applies to range is unchanged, that will still be the range that gets formatted.
If you are okay with a helper column then in cell B1 put 1.
and in cell B2:
=IF(A2=A1,B1,B1+1)
which you shall copy down. Afterwards, for A1:A9 range apply conditional formatting like below:
The outcome if implemented correctly will look like below.

Excel: How to take all results of a cell of a range of values in calculations

Cell A1 result comes from several calculations.
simplified example:
A1= B1+C1
B1= D1+1000
C1= E1*F1
For any new value in F1 I give a new result in A1.
I want to have all results of A1 for a range of values in F1.
ex: for F1 from 100 to 200, all A1 results write in a column
You can use following formula if you define range in one cell (F1 = 100:200):
=AGGREGATE(15,4,$D$1+1000+$E$1*ROW(INDIRECT($F$1)),ROW())
or if you want define range in separate cells (F1 = 100, F2 = 200):
=AGGREGATE(15,4,$D$1+1000+$E$1*ROW(INDIRECT($F$1&":"&$F$2)),ROW())

how to backcheck aganist cells and data validation list?

I've set cell A1 with data validation with list of possibilities: a,b,c,d
next I would need formula which will do this:
if a is chosen in A1 cell, set cell C1=b, C2=c, C3=d
if b is chosen in A1 cell, set cell C1=a, C2=c, C3=d
if c is chosen in A1 cell, set cell C1=a, C2=b, C3=d
if d is chosen in A1 cell, set cell C1=a, C2=b, C3=c
is there some handy formula for this purpose which I will place in cells C1, C2 and C3 which will backcheck with A1 and also between themselfs to avoid duplications?
google-spreadsheet
C1:
=FILTER({"a";"b";"c";"d"},{"a";"b";"c";"d"}<>A1)
The following array formula will do the job in Excel (select the range C1:C3 and use Ctrl+Shift+Enter to enter the formula):
=MID(REPLACE("abcd",MATCH(A1,{"a","b","c","d"},0),1,""),ROW(),1)
You haven't specified what you want the result to be if A1 contains neither of those values, but you may wish to wrap it in IFERROR().

Excel Named cell as a column inside of a formula?

I have a value in A1 that is a named cell. I want to use that value to perform an equation on a column. Something like: sum(ColumnTest:ColumnTest)
So If A1 = "C" and its a Named cell "ColumnTest"
so If I typed the following into B1 I would get "6". =Sum(ColumnTest:ColumnTest)
C1 = 1
C2 = 2
C3 = 3
Any suggestions on how to do this?
You can use the INDIRECT function:
=SUM(INDIRECT(ColumnTest&":"&ColumnTest))
or simply:
=SUM(INDIRECT(A1&":"&A1))
if the cell wasn't named.

Excel: Cell contents as formula requirements

I have a simple formula =sum(sum(d5*u300)/g4)
Is it possible to have the formula look up cell A1 for the d, a2 for the 5, a3 for the u, A4 for the 300, A5 for the the g and a6 for the 4. In other word each formula cell reference is made up of the contents of two other cells.This would be used in a selection process to produce a table for a graph. NON Excel Users could then use a drop down list in A1 to select column d etc. With thanks.
Do you mean something like:
=SUM(SUM(INDIRECT(A1&A2)*INDIRECT(A3&A4))/INDIRECT(A5&A6))
? Let's say A1 contains D and A2 contains 5. Then INDIRECT(A1&A2) will return the value of the cell D5.
However, I don't understand why you use SUM with just one argument.

Resources