Set range in formula via a cell - excel

Is there a way to set the range of a formula by reference to another cell's content? I need the formula to be dynamic based on what I key. For example, I need the formula: Sum(A1:B10), is there a way to do this:
=Sum("RefrenceCellC1" : "RefrenceCellC2")
(where C1 = A1 and C2 = B10), so if I change cell C2 content to B20 the formula then becomes: Sum(A1:B20)?

For the sake of an answer (as alluded to by #tigeravatar):
=SUM(INDIRECT(C1&":"&C2))

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.

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().

Insert a value to a cell in excel using formula in another cell

I need to insert a value to a cell in excel using formula in another cell.
Say
A1 = "Test"
B1 = formula to insert A1 to C1
C1 = A1
Can I write a formula in B1 to insert value in C1?
I don't need any formulas in C1.
If Yes, What should be the formula?
If there it is next to the cell AND has no value in B2, it is possible, otherwise it is not.
Use Split()
Split(CONCATENATE("Text for B1#Sperator$$",A1),"#Sperator$$",FALSE)
It really depends.
EDIT
Out dated. Only works in google sheets.
Without using VBA or formulas in column C you can't achieve this.
A simple solution using formulas:
In cell C1, paste the following formula and drag it down:
=IF(B1=1;A1;"")
So if the content of cell B1 is equal to 1, your cell at column C will display the respective value of the same row at column A.

How to link a cell to sheet reference

If I type Sheet2!A3 in A1 Cell of Sheet1, it will show the value of A3 cell of Sheet2. But I want to use this reference link from a cell in Sheet1
Please, look at the snapshot. I want to use the C1 cell to get the Sheet2 part of Sheet2!A3. So If I change the value of C1 from Sheet2 to Sheet3, then the formula in A1 will be changed to Sheet3!A3.
How to achieve this?
Try: =INDIRECT($C$1&"!A" & ROW() + 2)
This will mean you can have any sheet name in C1, and it should be able to get whatever cell you specify in the quotes (don't forget the exclamation mark!)
EDIT: Sorry, I missed that part, I've updated it now and it should work to increment.
You can add in another cell to make things simpler
In Sheet2 A3 i have the Value 10
And these formula Get that value with just some simple Indirect reference
If you want to make A3 Dynamic as well then :
The Aim is to get a cell which constructs the name of the cell/s you want to reference and then you can indirect Reference them accordingly.

Apply formula on condition

I'd like to add a condition to one of my Excel formulas. In Cell C1 I have a formula like this : = A1 +B1 but if cell A1 is empty but cell B1 does contain a value (or vice versa) I'd like cell C1 to stay empty.
Condition : Only apply formula if both cells contain any value.
(The formula I'm using in cell C1 calculates the difference between dates, and does this for a list of values, so it is applied on the whole range "C:C".)
Here you go
=IF(OR(A1="",B1=""),"",A1+B1)
=IF(SUM(IF(A1="",0,1),IF(B1="",0,1))<2,"",A1+B1)

Resources