Forum Discussion

MMEXCEL1's avatar
MMEXCEL1
Copper Contributor
Jul 09, 2024
Solved

How to skip to next cell value if current cell doesn't match the criteria in the formula

Hi,

 

I have a following problem:

 

In Sheet1 employees copy/paste some data about customers.

They always have same 5 rows and are always copies in column A (see photo below):

 

There can be thousands of rows because they keep adding each day new data.

 

I need to create a formula in Sheet2 to copy/paste all this data (using formula, not actually copy/pasting) into a table which is more easier to filter data in.

Example how I want it to look like:

 

so,

I want it all copied like this and avoid blank rows.

I tried using this formula for A2 in Sheet2 (and similar for B2,C2....) , but I am not sure how to skip the cell if it doesn't match the criteria, so it ends up looking like this: =IF(COUNTIF(Sheet1!$A2,"*E-mail*"),Sheet1!$A2,"")

 

 

Any idea how to do this using a formula or is VBA needed here?

 

Thanks in advance!

3 Replies

  • djclements's avatar
    djclements
    Silver Contributor

    MMEXCEL1 Since you've tagged Office 365, and the number of rows per record is consistent (5), you could also try using WRAPROWS with TEXTAFTER and TOCOL to spill the results for the entire range with a single formula:

     

    =WRAPROWS(TEXTAFTER(TOCOL(A:A, 1), ": "), 5)

     

    TOCOL removes the blank rows by setting the optional [ignore] argument to 1.

     

    Sample Results

    • MMEXCEL1's avatar
      MMEXCEL1
      Copper Contributor
      Thank you for your quick response!
      Worked perfectly 🙂

Resources