Get value of last visible cell - excel

I am using this formula in cell B1 to get last value of visible cell
=LOOKUP(2;1/((SUBTOTAL(3;OFFSET(A2:A10;ROW(A2:A10)-MIN(ROW(A2:A10));0;1)))*(1-ISBLANK(A2:A10)));A2:A10)
It works well when cell from A1 to A10 doesn't contain a formula. The problem is that this formula not working when the cell contains a formula with an if statement.
For example, when in cell A10 I put the formula =IF(F1=1;1;""), the cell a10 shows blank because the condition is not true - and when I filter data the cell B1 show blank.

Replace:
1-ISBLANK(A2:A10)
with:
LEN(A2:A10)>0
Regards

I would use some different formula for that purpose. One option (array formula - Ctrl + Shift + Enter):
=INDIRECT("A"&MAX(IF(A2:A10="";0;ROW(A2:A10))))
another array formula option:
=INDEX(A2:A10;MAX(IF(A2:A10="";0;ROW(A2:A10)))-1)

Related

Google Sheets or Excel: setting the value of a remote cell from a formula

Is there a way to create a formula in one cell that will change the value in another cell based on some criteria, without scripting? Example: cell a1 contains a numerical value. cell b1 contains a value from a drop-down list, say, "YES,NO". If cell b1 is set to "YES" I want to remove (set to zero) the value in cell a1. What I'd like to do is have a formula in cell c1 that interrogates b1 and sets the value in a1 accordingly. Is the only way achieve this writing code and using setValue?
you cant remove it without a script. you can visually hide it in various ways. if the A1 is subject of further sum (as in your case per your comment) the sum formula can be always altered to reflect desired output. example:
if your formula is
=SUM(A1, C5, D22)
you can do
=SUM(IF(B1="YES", 0, A1), C5, D22)
Use the following on the cell you need the calculation (or zero) on:
=IF (B1="YES",0,SUM(A:A))
Using the given formula, you would do the SUM calculation for the whole Column A if the value on B1 is "YES", if not, then a 0 would be placed on the cell you put the formula on.

I have to cells, A1 and B1, I want to display the value of A1 or B1 when either cell have value entered

I have two cells, A1 and A2, I want to display the value of A1 or A2 in cell B1 when either cell have value entered. how do I create the formula for cell B1?
=TEXTJOIN(",",TRUE,A1:A2)
This formula will only return nonblank cells (because of the 'TRUE' argument). If both cells are nonblank, it will return both values seperated by a comma, (because of the '", "' argument)
Alternatively if you want to only return one cell even if both were occupied, you could prioritize A1 like this.
=IF(ISBLANK(A1),A2,A1)
As far as I can tell, the following should serve:
=A1&A2
where TEXTJOIN is not available.
Questions tagged with excel should be version-agnostic.

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 create formula in excel that can iterate in specific range?

I want to fill down 10 cells with value from B10 cell:
='Disconnect Minor Reason List'!$B$10
Then I want to get another 10 cells with value from B11 cell, then another 10 from B12 and so on.
Is it a possible in Excel?
First approach (better one, since it's not volatile):
write formula in E10 cell: =B10
write formula in E11 cell: =INDEX($B$10:$B$12,1+INT(COUNTA($E$10:E10)/10))
and drag it down.
Second approach: (if you'd like to use single formula)
use this formula in E10 and drag it down:
=INDEX($B$10:$B$12,1+INT((ROW()-ROW($E$10))/10))

Resources