pick negative figures with all related columns data

Zubair

Active Member
Joined
Jul 4, 2009
Messages
304
Office Version
  1. 2016
Platform
  1. Windows
I have a huge data with many years and products, from that I want to pick only negative figures and there corresponding row/column data, please help with formula.

DATA
ProductMonthVolumeGMCPL
Product AFeb1214.001.17
Product BJan1315.001.15
Product BMar14(15.00)(1.07)
Product BFeb1510.000.67
Product AJan16(15.00)(0.94)
Product AMar1715.000.88

Result required.

ProductMonthVolumeGMCPL
Product BMar14(15.00)(1.07)
Product AJan16(15.00)(0.94)
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Highlight your first row (Headers)
Select Data-->Filter
Click on the drop down filter for GM column
Select Number Filters
Select Less than
Place a 0 in the criteria.
 
Upvote 0
Highlight your first row (Headers)
Select Data-->Filter
Click on the drop down filter for GM column
Select Number Filters
Select Less than
Place a 0 in the criteria.
Hi alansidman,

Many thanks but I wanted to bring data in other sheet.
 
Upvote 0
Highlight filtered data
copy-->paste.

If you want to automate, then do these steps and record as Macro.
 
Upvote 0
Here is a vba code for you

VBA Code:
Option Explicit

Sub NegNum()
    Dim s1 As Worksheet, s2 As Worksheet
    Dim i As Long, lr As Long, lr2 As Long
    Set s1 = Sheets("Sheet1")
    Set s2 = Sheets("Sheet2")
    lr = s1.Range("A" & Rows.Count).End(xlUp).Row
    s1.Range("A1:E1").Copy s2.Range("A1")
    For i = 2 To lr
        If s1.Range("D" & i) < 0 Then
            s1.Range("A" & i & ":E" & i).Copy
            lr2 = s2.Range("A" & Rows.Count).End(xlUp).Row + 1
            s2.Range("A" & lr2).PasteSpecial xlPasteValues
        End If
    Next i
    Application.CutCopyMode = False
    MsgBox "Completed"
End Sub
 
Upvote 0
I wanted to bring data in other sheet.
Does the other sheet already exist?
If so, does it already have any other data on it?

Is it ever possible that GP is less than zero and CPL is greater than zero, or vice versa? If so, what should happen with those rows?

How big (approximate number of rows) is your 'huge' data?

Is there just 5 columns & and are they A:E?
 
Upvote 0
Does the other sheet already exist?
If so, does it already have any other data on it?

Is it ever possible that GP is less than zero and CPL is greater than zero, or vice versa? If so, what should happen with those rows?

How big (approximate number of rows) is your 'huge' data?

Is there just 5 columns & and are they A:E?
in new sheet which is blank
yes GP is less than Zero and I want to shown only those sales transactions which are having negative Gross Margin (means selling price is less than cost).
I have 24 rows and 27910 columns and data is keep increasing.
Column A:X and GM CPL is in column X
 
Upvote 0
BusinessActual/PlanAreaSectorItemDescriptionProduct FamilyPackIMP/LocalYearQuarterMonthYTD No.VolumeGSV SARRebateDiscountTurnover SARStd Cost SARStd Gross Profit SARTurnover US$Std Cost US$Std Gross Profit US$GM CPL
Region 4ActualsArea Manager 18Segment 4PKG09010208HyoJet 68 208 ltrHyo
208​
LocActualsQ1Jan
90​
13,4086,456,045(129,121)(3,357,143)2,969,7815,109,318(2,139,537)791,0561,360,961(569,905)(42.50)
 
Upvote 0
I have 24 rows and 27910 columns and data is keep increasing.
Are you sure you have that the correct way around? :unsure:
Rows run across the worksheet and columns run down the worksheet


Column A:X and GM CPL is in column X
Previously you showed GM and CPL in separate columns, now you show them in a single column. Can you confirm which it actually is?

Are there any formulas in the worksheet?

in new sheet which is blank
My question was does the sheet already exist? Or can the code create a new sheet as part of the process?
 
Upvote 0
BusinessActual/PlanAreaSectorItemDescriptionProduct FamilyPackIMP/LocalYearQuarterMonthYTD No.VolumeGSV SARRebateDiscountTurnover SARStd Cost SARStd Gross Profit SARTurnover US$Std Cost US$Std Gross Profit US$GM CPL
Region 4ActualsArea Manager 18Segment 4PKG09010208HyoJet 68 208 ltrHyo
208​
LocActualsQ1Jan
90​
13,4086,456,045(129,121)(3,357,143)2,969,7815,109,318(2,139,537)791,0561,360,961(569,905)(42.50)
Are you sure you have that the correct way around? :unsure:
Rows run across the worksheet and columns run down the worksheet
apologies it vice versa
 
Upvote 0

Forum statistics

Threads
1,215,427
Messages
6,124,831
Members
449,190
Latest member
rscraig11

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