FILTER formula that will hide blank rows.

lite4d

Board Regular
Joined
Jan 25, 2010
Messages
50
I have a spreadsheet that I want to filter data based on dates and the data will range from 3 rows to 120 rows based on the dates that are chosen. What I need to do is add something in the formula to shrink the rows to just the ones with data and expand with the data as required. My current formula is below:

=FILTER('Random Receipts'!A2:Q120,('Random Receipts'!K2:K120>=C3)*('Random Receipts'!K2:K120<=D3))

Right now I have to have 120 rows to cover for the data that "could" be there. I want it to shrink and grow as required. What do I need to add to my formula to get that to work?

I have tried a few things but nothing is working correctly. I just get the $spill error.

Thanks for the help as always!!
 
Can you post some sample data, from both sheets with the formula in place.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Yeah I wrote that wrong If I leave just the first row with the formula in it I get the #spill error.
 
Upvote 0
Can you post some sample data, from both sheets with the formula in place.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
I'm very limited on my work computer as to what I can download. I moght can send it to my home and do it form there. Let me try that.
 
Upvote 0
You need to select the range of cells you want to display, not a single cell.
 
Upvote 0
If for example you have this data:

RandomReceipts.xlsx
ABCDEFGHIJKLMNOPQ
1Header 1Header 2Header 3Header 4Header 5Header 6Header 7Header 8Header 9Header 10Header 11Header 12Header 13Header 14Header 15Header 16Header 17
2[^S\IJVTFYQLD]OPI^NEBGI\WIHJTSHKQJZ]O[MI2024-01-01EQQSPTI^N\BLPCECFRDJBM][
3HAECVFEDX^VLMHWTJENYANPMEHXH^GHWTCN]CG[P2024-01-02[SB]DZ^BSV[SUXBMJZ[LXXOG
4XWYIXCG[ZMWKPQJSHDC]FVDJUSIMAH]\IWQIOC]K2024-01-02[AUN[GATS\IISZQFAOY[TKEG
5ASIRRBUWXX[]BC\INQBV]XZ[V]REU^N^[LVKVRMA2024-01-02JCGR]I^YFUEV^^DMIOCJDUQZ
6UHMUTYMZHOIYGIMCPRHAHLIMQZMJKMZYFWU][KHS2024-01-02^JCVSJ\KQXPFPZEUNPINUSQG
7LE]CEREDZJ\UQUKOHQFCMEDUSEK[CM[CYFNPKDUK2024-01-03ZVOG^S]\OZBNWOMGDRE]WWWE
8KNCTEHWCPHNBFL]]JPA\KWXCANUKPJONGXBHWFR[2024-01-03VLWJU\BWN[KZKPIRFPDPVOBS
9ZZWNTCPT[]LLAOR[MTBQNYB]IS[EDPLOTYMKYKVP2024-01-03XIW]FIKNMBNNNVSYXJJ^V[ON
10U]PK]WAWSNKZWAVX]Y^\^MACMZEJJJFLSTEOTJIE2024-01-03GSCUNZ^]IXURMLAAPOGHC]X[
11^BSZSZOB^ZP[WHARRB^\QJH\WNKOLGUPCKXDCTEK2024-01-04CWGLU^HXPQRNR\XJMXGYTUJX
12TUCDLVK\OMEBWAIEPVUCA\P]CQSSTQOG^VHXFACA2024-01-04MO^S^QCGRQXPLTGYIVYLJPM[
13WERIUAL]XV[PHAWBHILBBKIJSSGANY]C^EFONDI]2024-01-04Q^KOU[DUAVZSKH^KGAFFHJ[C
14HBQWOS[BKFDV^LPXH^HMENYJMKGGZJISCNVTORUB2024-01-04SNY^GXAD[BGDXUDEFLGB\LWO
15K^ZOWADOCIOOQSTAS[OBYDAR[URSB^EIPAXHIOWR2024-01-05IOA^[JZ[L]\NRUVAHX]W\TTD
Random Receipts


You should get:

RandomReceipts.xlsx
ABCDEFGHIJKLMNOPQ
32024-01-012024-01-01
15[^S\IJVTFYQLD]OPI^NEBGI\WIHJTSHKQJZ]O[MI2024-01-01EQQSPTI^N\BLPCECFRDJBM][
16
Sheet1
Cell Formulas
RangeFormula
A15:Q15A15=FILTER('Random Receipts'!A2:Q120,('Random Receipts'!K2:K120>=C3)*('Random Receipts'!K2:K120<=D3))
Dynamic array formulas.


RandomReceipts.xlsx
ABCDEFGHIJKLMNOPQ
32024-01-012024-01-02
15[^S\IJVTFYQLD]OPI^NEBGI\WIHJTSHKQJZ]O[MI2024-01-01EQQSPTI^N\BLPCECFRDJBM][
16HAECVFEDX^VLMHWTJENYANPMEHXH^GHWTCN]CG[P2024-01-02[SB]DZ^BSV[SUXBMJZ[LXXOG
17XWYIXCG[ZMWKPQJSHDC]FVDJUSIMAH]\IWQIOC]K2024-01-02[AUN[GATS\IISZQFAOY[TKEG
18ASIRRBUWXX[]BC\INQBV]XZ[V]REU^N^[LVKVRMA2024-01-02JCGR]I^YFUEV^^DMIOCJDUQZ
19UHMUTYMZHOIYGIMCPRHAHLIMQZMJKMZYFWU][KHS2024-01-02^JCVSJ\KQXPFPZEUNPINUSQG
Sheet1
Cell Formulas
RangeFormula
A15:Q19A15=FILTER('Random Receipts'!A2:Q120,('Random Receipts'!K2:K120>=C3)*('Random Receipts'!K2:K120<=D3))
Dynamic array formulas.


RandomReceipts.xlsx
ABCDEFGHIJKLMNOPQ
32024-01-012024-01-03
15[^S\IJVTFYQLD]OPI^NEBGI\WIHJTSHKQJZ]O[MI2024-01-01EQQSPTI^N\BLPCECFRDJBM][
16HAECVFEDX^VLMHWTJENYANPMEHXH^GHWTCN]CG[P2024-01-02[SB]DZ^BSV[SUXBMJZ[LXXOG
17XWYIXCG[ZMWKPQJSHDC]FVDJUSIMAH]\IWQIOC]K2024-01-02[AUN[GATS\IISZQFAOY[TKEG
18ASIRRBUWXX[]BC\INQBV]XZ[V]REU^N^[LVKVRMA2024-01-02JCGR]I^YFUEV^^DMIOCJDUQZ
19UHMUTYMZHOIYGIMCPRHAHLIMQZMJKMZYFWU][KHS2024-01-02^JCVSJ\KQXPFPZEUNPINUSQG
20LE]CEREDZJ\UQUKOHQFCMEDUSEK[CM[CYFNPKDUK2024-01-03ZVOG^S]\OZBNWOMGDRE]WWWE
21KNCTEHWCPHNBFL]]JPA\KWXCANUKPJONGXBHWFR[2024-01-03VLWJU\BWN[KZKPIRFPDPVOBS
22ZZWNTCPT[]LLAOR[MTBQNYB]IS[EDPLOTYMKYKVP2024-01-03XIW]FIKNMBNNNVSYXJJ^V[ON
23U]PK]WAWSNKZWAVX]Y^\^MACMZEJJJFLSTEOTJIE2024-01-03GSCUNZ^]IXURMLAAPOGHC]X[
Sheet1
Cell Formulas
RangeFormula
A15:Q23A15=FILTER('Random Receipts'!A2:Q120,('Random Receipts'!K2:K120>=C3)*('Random Receipts'!K2:K120<=D3))
Dynamic array formulas.
 
Upvote 0
The data I draw is correct based on the dates I choose. I'm looking to get rid of the blank rows that come after it to avoid the #SPILL error. I have to add 120 rows because after a month I have the potential to have that many rows, but when I only look at 1 day I should only see three rows vice three rows of data and 117 blank rows.
 
Upvote 0
I don't understand what blank row you mean. Filter will not return any blank rows.
Can you show a screenshot, XL2BB or upload the file?
 
Upvote 0
I don't understand what blank row you mean. Filter will not return any blank rows.
Can you show a screenshot, XL2BB or upload the file?
When I filter by the dates in C3 and D3I get the data I want but I don't want the blank rows below it. As of now, I have to have 120 rows to prevent the #SPILL error. Is there a way to filter only the data and not the blanks? Basically I want the data to grow or shrink and show only the data that meets the date criteria and not the blank rows.

2024-01-10_9-12-01.jpg
 
Upvote 0
If the formula is in B15 only then you should not get any blank rows.
What error message do the error flags show?
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top