If function BUT with empty cells in between

pedexe90

Board Regular
Joined
Apr 18, 2018
Messages
59
Hello everyone,

I am looking for a formulate to incorporate the if function to another function that would avoid leaving gaps (empty cells) in between.

So I have data from lets say A1:A50

I want non zero values to be populated in column B without gaps in between.

Sorry if this is too easy and thanks for your help.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Excel 2010
AB
177
208
387
479
591
612
723
834
945
1056
1168
1209
13855
14966
155512
166699
17127
189944
1977
204477
2177
22778
2376
2481
2566
2611
2766
2817
2967
3077
31766
3277
33667
3477
35799
3677
37997
3877
39778
4077
41786
4277
4367
4474
4507
4674
4747
487 
494 
507 
Sheet4
Cell Formulas
RangeFormula
B1{=IF(ROWS(B$1:B1)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B1))))}
B2{=IF(ROWS(B$1:B2)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B2))))}
B3{=IF(ROWS(B$1:B3)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B3))))}
B4{=IF(ROWS(B$1:B4)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B4))))}
B5{=IF(ROWS(B$1:B5)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B5))))}
B6{=IF(ROWS(B$1:B6)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B6))))}
B7{=IF(ROWS(B$1:B7)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B7))))}
B8{=IF(ROWS(B$1:B8)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B8))))}
B9{=IF(ROWS(B$1:B9)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B9))))}
B10{=IF(ROWS(B$1:B10)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B10))))}
B11{=IF(ROWS(B$1:B11)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B11))))}
B12{=IF(ROWS(B$1:B12)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B12))))}
B13{=IF(ROWS(B$1:B13)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B13))))}
B14{=IF(ROWS(B$1:B14)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B14))))}
B15{=IF(ROWS(B$1:B15)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B15))))}
B16{=IF(ROWS(B$1:B16)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B16))))}
B17{=IF(ROWS(B$1:B17)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B17))))}
B18{=IF(ROWS(B$1:B18)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B18))))}
B19{=IF(ROWS(B$1:B19)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B19))))}
B20{=IF(ROWS(B$1:B20)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B20))))}
B21{=IF(ROWS(B$1:B21)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B21))))}
B22{=IF(ROWS(B$1:B22)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B22))))}
B23{=IF(ROWS(B$1:B23)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B23))))}
B24{=IF(ROWS(B$1:B24)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B24))))}
B25{=IF(ROWS(B$1:B25)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B25))))}
B26{=IF(ROWS(B$1:B26)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B26))))}
B27{=IF(ROWS(B$1:B27)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B27))))}
B28{=IF(ROWS(B$1:B28)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B28))))}
B29{=IF(ROWS(B$1:B29)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B29))))}
B30{=IF(ROWS(B$1:B30)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B30))))}
B31{=IF(ROWS(B$1:B31)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B31))))}
B32{=IF(ROWS(B$1:B32)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B32))))}
B33{=IF(ROWS(B$1:B33)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B33))))}
B34{=IF(ROWS(B$1:B34)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B34))))}
B35{=IF(ROWS(B$1:B35)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B35))))}
B36{=IF(ROWS(B$1:B36)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B36))))}
B37{=IF(ROWS(B$1:B37)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B37))))}
B38{=IF(ROWS(B$1:B38)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B38))))}
B39{=IF(ROWS(B$1:B39)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B39))))}
B40{=IF(ROWS(B$1:B40)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B40))))}
B41{=IF(ROWS(B$1:B41)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B41))))}
B42{=IF(ROWS(B$1:B42)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B42))))}
B43{=IF(ROWS(B$1:B43)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B43))))}
B44{=IF(ROWS(B$1:B44)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B44))))}
B45{=IF(ROWS(B$1:B45)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B45))))}
B46{=IF(ROWS(B$1:B46)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B46))))}
B47{=IF(ROWS(B$1:B47)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B47))))}
B48{=IF(ROWS(B$1:B48)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B48))))}
B49{=IF(ROWS(B$1:B49)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B49))))}
B50{=IF(ROWS(B$1:B50)>COUNTIF($A$1:$A$50,">0"),"",INDEX($A$1:$A$50,SMALL(IF($A$1:$A$50>0,ROW($A$1:$A$50)-ROW($A$1)+1),ROWS(B$1:B50))))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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