# List without blank and if condition

#### mba_110

##### New Member
Hi everyone,

I got some difficulty in sorting out the below formula, it is a complex one with array.

Code:
``=IFERROR(INDEX(Payroll!\$C\$9:\$C\$95,SMALL(IF(ISTEXT(Payroll!\$C\$9:\$C\$95),ROW(Payroll!\$C\$8:\$C\$94),""),ROW(Payroll!C9))),"")``

formula return with no value (The value i am calling is text)

Now what i am trying to do?

I am trying to make list without blanks its for my payroll sheet and i am trying to extract the full list without blank and with a condition that if salary amount cell which is Payroll!AB9 is not null then only that employees name should appear in list otherwise list serial should skip his name and go to next, same for all,

in above i manage to get only the code that make list without blank which is also not giving the value and in addition to that i want the add if(Payroll!AB9<>"",Payroll!C9,"") but first above code should work properly.

Any help here will be appreciated.

Thanks.

### Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

#### James006

##### Well-known Member
Hello,

To make your life easier, you should create a named range for your Payroll!C9:C95 area ... such as rng ... and have Array Formula :

Code:
``=IF(ROWS(\$2:2)<=COUNTA(rng),INDEX(rng,SMALL(IF(rng<>"",ROW(rng)-MIN(ROW(rng))+1),ROWS(\$2:2))),"")``

Hope this will help

#### Fluff

##### MrExcel MVP, Moderator
Another option, this is a normal formula, rather than an array formula
=IFERROR(INDEX(Payroll!\$C\$9:\$C\$95,AGGREGATE(15,6,ROW(Payroll!\$C\$9:\$C\$95)-ROW(Payroll!\$C\$9)+1/(Payroll!\$C\$9:\$C\$95<>""),ROWS(\$1:1))),"")

Last edited:

#### mba_110

##### New Member
Thanks fluff your formula is working perfect, however as i said i want to add the if(Payroll!AB9<>"",Payroll!C9,"") if employee's salary is zero on payroll!AB9 starting from first row then his name should not appear in list and go to next name i try to amend your formula like below but its not showing correct result, still showing the blank cells if payroll!AB9 is zero or null.

Code:
``=IFERROR(IF(Payroll!AB9<>"",INDEX(Payroll!\$C\$9:\$C\$95,AGGREGATE(15,6,ROW(Payroll!\$C\$9:\$C\$95)-ROW(Payroll!\$C\$9)+1/(Payroll!\$C\$9:\$C\$95<>""),ROWS(\$1:1))),""),"")``

Where i am making mistake ?

Last edited:

#### Fluff

##### MrExcel MVP, Moderator

=IFERROR(INDEX(Payroll!\$C\$9:\$C\$95,AGGREGATE(15,6,ROW(Payroll!\$C\$9:\$C\$95)-ROW(Payroll!\$C\$9)+1/((Payroll!\$C\$9:\$C\$95<>"")*(Payroll!\$AB\$9:\$AB\$95<>0)),ROWS(\$1:1))),"")

#### mba_110

##### New Member
That is great again....thumps up genius

Now i am taking it to final level, i got some employees to whom i am not paying directly and i have another list in summary showing there names as in payroll sheet and i want to exclude them from this list as well whether there is an amount on payroll!AB9 or not.

the rage for excluding employee is in sheet Summary!B24:B30

I hope this can be possible.

#### Fluff

##### MrExcel MVP, Moderator
Whilst it's almost certainly possible, that's beyond my knowledge.
Hopefully one of the Formula folk step in & help.

Replies
3
Views
77
Replies
6
Views
94
Replies
7
Views
40
Replies
1
Views
16
Replies
3
Views
75