Fill contents from the first filtered cell VISIBLE below - excel-formula

Please have a look at table 1 and table 2. If I select the filter for C (table 2), I want the cell A1 to be filled with the value that is filtered and present immediatley below A1, that is C (another example is if I select filter for value B, then A1 should be filled with value B ). For this, I have used this formula for A1 =INDEX(A2:A5, MATCH(1, SUBTOTAL(3,OFFSET(A2,ROW(A2:A5)-ROW(A2),0,1)), 0)) but it is giving errors. Please help.

Entering it as an array formula (with CTRL+Shift+Enter, instead of just Enter) worked. That was missing.

Related

filling excel column automatically where another column is not null

I want to fill an excel column with a specific value where another column in the same sheet is not null(I've used '-' for all the empty cells). Can I automate this?
For example, in the screenshot, where ever I have a value, I want to insert 'Hi' (Only at the places with a value) and omit where there is blank space represented by '-'. Also, it should not edit the values in B column if there is anything already present in it.
You can use if function to do this task. Suppose you have data to test in Cell A1 then you can enter Formula in cell B1 as =if(A1<>"-","Hi","") this means if Data in cell A1 is not - then enter Hi in cell B1 else keep B1 empty. See Screenshot attached.
You can do the following: suppose column A is full of values and you want to fill column B with "-". First, write the value "-" in the cell "C1", then select column B and write in B1 =$C$1 and then press Ctrl+Enter Key that's it
=IFERROR(IF(B1="","-",COUNTBLANK(INDIRECT("B1:B"&ROW()-1))+1),1)
Or avoiding INDIRECT:
=IFERROR(IF(B1="","-",SUM(IF(INDEX(B:B,SEQUENCE(ROW()-1))="",1))+1),1)

Find the Last Cell Value of the 2nd Column Set for each 1st Column Cell in EXCEL

I have the following structured table in excel where 1000s of rows included.
I want to return the Last Cell Value of Column B for Each value in Column A.
For example:
For Cell A1 -> I want to return the Cell B5.
For Cell A6 -> I want to return the Cell B9.
I have tried with VLOOKUP, HLOOKUP, INDEX likewise so many formulas where I ended with more conflict situations. Can anyone please write down a Formula to give my requirement a life?
Array formula (Press Control + Shift + Enter while entering the formula) in cell C1 and copy it down.
=IF(A1="","",IFERROR(INDEX($A2:$B$20,MATCH(FALSE,ISBLANK($A2:$A$20),0)-1,2),LOOKUP(2,1/(B2:$B$20),B2:$B$20)))
if you don't mind using column C as a helper column you could use something like that:
If you won't use Array formula you can Use this solution:
like this image:
use column C as helper with this formula in first cell =OFFSET(A1;SUMPRODUCT(MAX(($A$1:$A1<>"")*(ROW($A$1:$A1))))-ROW(A1);0)
and use this formula in column D's first cell =IF(A1="";"";INDEX($B$1:$B$13;SUMPRODUCT(MAX((ROW($A$1:$A$13))*($C$1:$C$13=A1)))))
and copy fill-down to all cells.
Try this shorter, without helper column and non-array formula solution
In C1, formula copied down :
=IF(A1="","",INDEX(B1:B$9,MATCH(1,FREQUENCY(1,0+(A2:A$9<>"")),0)))

Fill blank value in Excel

Need help in Excel for the following problem
ColA ColB
A1 B1
A2 B2
A3 B3
A4
A5 B5
A6 A6
A6
A6
if Column B is blank, I need to copy the value of ColA into ColB. But if the value is already present, then no action is needed.
Is it with formula or Vba?
A formula like should be ok (you copy/paste this formula to every cells in your Col)
=IF(B1="",A1,B1)
In column C enter the following formula:
=IF(B1="", A1, B1)
Copy this formula down column C. Then, assuming it looks right, you may delete the current column B, leaving the new column to become the new column B.
It is important to note that this formula won't work if directly entered into column B. In that case, Excel would complain about a circular reference.
Highlight the entire column B used range and press Ctrl+F to open find and replace then insert select
find " " (leave blank)
replace =OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),,-1,1)
Which looks like:
Result:
This, INDIRECT(ADDRESS(ROW(), COLUMN()), refers to the cell itelf, and -1 column offset argument refers to column to left.
You can then do copy paste as values to convert formulas to hard coded values.

Identify minimum and maximum values based on 3 criteria

In the table shown, I need a formula for column D that will indicate the first date (minimum) and most recent date (maximum) that each participant (in column A) took survey A (in column C). Column D would need to indicate "first" and "last" tied to the Participant ID--for example, I would want D2 to populate with "3Last" and D5 to populate with "3First." Column E displays what I would need column D to display. If it's not a first or last date (something in between), or if it's not survey A, the cell in column D would be left blank or 0. If there is only one date that meets the criteria, it should return "First" rather than "Last." I'm pretty stumped on this one... Any help is much appreciated!
In E2, insert the ARRAY formula listed below. If you have never used an array formula, follow these steps:
select the formula from this page
copy it
go to excel
select cell E2,
press the 'F2' key
paste the formula
press CTRL+SHIFT+Enter (instead of just pressing enter)
To copy down, follow these steps:
Copy cell E2
Move down to cell E3 (instead of selecting a range)
Paste in cell E3
Select your range and paste from there.
If you don't copy down in this manner, it will tell you that you cannot change the array...
=IF($C2="A",IF($B2=MIN(IF(($C$2:$C$7=$C2)*($A$2:$A$7=$A2),$B$2:$B$7)),CONCATENATE($A2,"Last"),IF($B2=MAX(IF(($C$2:$C$7=$C2)*($A$2:$A$7=$A2),$B$2:$B$7)),CONCATENATE($A2,"First"))),0)
HTH

Run two vlookup if an 'N/A'

I am currently in the process of trying to create a vlookup function that will check cell A2 and check it on sheet1. If it brings back an error, it should go to B2 and then check on sheet1 and bring back the results.
This is what i currently have:
=IF(ISNA(VLOOKUP(A2,'Sheet1'!$A$2:$A$1932,1,FALSE)),"0",VLOOKUP(B2,'Sheet1'!$A$2:$A$1932,1,FALSE))
But it doesn't seem to be bringing back all the results, it is bringing back some results from each list A2 and B2.
What am i doing wrong?
Thanks in advance.
This should work:
=IFERROR(VLOOKUP(A2,'Sheet1'!$A$2:$A$1932,1,FALSE),VLOOKUP(B2,'Sheet1'!$A$2:$A$1932,1,FALSE))
It will use A2 to and try and find it in sheet1 and if it returns an error, it will go B2 and find the item on sheet1.
Try using:
=IF(ISNA(VLOOKUP(A2,'Sheet1'!$A$2:$A$1932,1,FALSE)),"0",VLOOKUP(A2,'Sheet1'!$A$2:$B$1932,2,FALSE))
Or you can use an IFERROR to make things shorter:
=IFERROR(VLOOKUP(A2,'Sheet1'!$A$2:$B$1932,2,FALSE),"0")
(You can omit the quotes around 0 if you mean a numerical 0 as opposed to a text 0)
This formula will get the value from column B in Sheet1 using the lookup value A2 from Sheet2 and looking it up in column A in Sheet1.
VLOOKUP checks the value of A2 in column Sheet1!A:A and returns the value from column Sheet1!B:B with the formula:
=VLOOKUP(A2,'Sheet1'!$A$2:$B$1932,2,FALSE)
^ ^
1 2
B is the result column
2 is in the index relative to A. A is column 1, B is column 2.
EDIT:
If you want to get the value from column A only, checking the value of A2 first and B2 on failure of the first, then you can use:
=IFERROR(VLOOKUP(A2,'Sheet1'!$A$2:$A$1932,1,FALSE),VLOOKUP(A2,'Sheet1'!$A$2:$A$1932,1,FALSE))

Resources