HELP: Advanced lookup - return list of all postive/negative

cpis0002

Board Regular
Joined
Jul 28, 2007
Messages
96
I have column C which is basically empty, apart from a few values (500 rows but only 10-15 rows with data), some of the numbers in column C are negative, and others are positive.


I need it to give me a list of all the positive values, and a list of all the negative values... So it will find any value which is not equal to zero and give me the text of each one found in column A.

I would do it by creating a 2 columns next to the data which numbers the postive data in one column, and negative data in the next.
That is: cell D150 will have the formula:
=IF(C150>0,COUNT($D$5:$D149)+1,""))

and then a lookup formula to lookup values (1,2,3,etc) and return the data in column A... but this is alot of work since I have a large amount of columns...

If you can come up with a better idea, please let me know.
Thanks again
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
Hi
Paste the following codes in the macro window ( Alt F11)

sub list()
b = 1
c = 1
x = Cells(Rows.Count, 3).End(xlUp).Row
For a = 1 To x
If Cells(a, 3) <> 0 Then
If Cells(a, 3) = Abs(Cells(a, 3)) Then
Cells(b, 4) = Cells(a, 3) & " and " & Cells(a, 1)
b = b + 1
Else
Cells(c, 5) = Cells(a, 3) & " and " & Cells(a, 1)
c = c + 1
End If
End If
Next a
end sub
run the macro. it will list all +ves in col D and negatives in col E along with values of col A
Ravi
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,279
Messages
5,836,363
Members
430,424
Latest member
ALHK022

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
Top