excelvbadatabaseconditional-statements

How do I select only filled-in values and use them in another worksheet in excel?


I have a large list of data parameters in excel that need to be filled in, where the first column is the parameter name, the second column is the value to be filled in and the third is the corresponding unit. I would like to create a second sheet where only the values that are actually filled in are shown, with their corresponding name and unit. I don't want any gaps between them.

I am very much new to using conditionals in excel and VBA, so hope there is someone here who can help me out. I've already tried several things based on similar situations that I found online but can't seem to get the right method and I always end up either with gaps in between the values or a non-working code.

Thanks!


Solution

  • If you are using a newer version of Office (eg Office 365), simply use the Filter-Function.

    Assuming that the parameter sheet is called "Sheet1", put the following formula to the second sheet:

    =FILTER(Sheet1!A:C,Sheet1!B:B<>"","no data found")
    

    Sheet1!A:C tells where you want to get the data from

    Sheet1!B:B<>"" defines a filter: Display data only if the value in column B is not empty.

    "no data found" writes the text if no matching data was found (no parameter is yet filled)

    As this is a formula, it will update the list in the 2nd sheet automatically whenever something is changed in the parameter sheet.