Excel query/macro , delete records where the aggregate value is not over 100

I have a spreadsheet with about 5000 records. I need to delete out the records where the Amount column is less than $10.00 unless the aggregate of the amount column is greater than or equal to $100. I have an ID column that matches to the name on the record.
So is it possible to create something that for each ID number in the ID column if the Amount column is less than $10 delete it unless the same ID appears again and is greater than $100? TIA

HI mkozz28,
>> I need to delete out the records where the Amount column is less than $10.00 unless the aggregate of the amount column is greater than or equal to $100.
In my option, you could sort the data by column ID, then loop through the column Amount, if the value of the Amount is less than 10, then find the cell according the same ID, if the Amout is less than 100, delete the enterRow.
For more information about Find method, you could turn to the link below
# Range.Find Method (Excel)
https://msdn.microsoft.com/en-us/library/office/ff839746.aspx
For the row delete, the link below might be useful to you
# Delete Method [Excel 2003 VBA Language Reference]
https://msdn.microsoft.com/en-us/library/office/aa223863(v=office.11).aspx
A simple demo as below, you need to modify it to your own requirement.
Sub test1()
For i = 2 To 8 'row number
Debug.Print ActiveSheet.Cells(i, 2).Value
'ActiveSheet.Cells(i, 2).Select
If (ActiveSheet.Cells(i, 2).Value <= 10) Then
Set cell = ActiveSheet.Range("A1:A8").Find(ActiveSheet.Cells(i, 1).Value, After:=ActiveSheet.Cells(i, 1), LookIn:=xlValues)
If cell Is Nothing Then
ActiveSheet.Cells(i, 2).EntireRow.Delete
Else
Debug.Print ActiveSheet.Cells(cell.Row, 2).Value
If ActiveSheet.Cells(cell.Row, 2).Value < 100 Then
ActiveSheet.Cells(i, 2).EntireRow.Delete
End If
End If
End If
Next i
End Sub
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.

Similar Messages

  • Sql delete record where duplicate in part of raw

    in sql table  i need to delete all record where the time between it  1 or 2 minute or the same and must be the same id but keep the firest record
        ID             Time                            SN   SD   WE   
    FW
        10    2014-06-30 19:17:37.000    I    0    100    0
        10    2014-06-30 19:17:42.000    I    0    100    0
        10    2014-06-30 19:17:46.000    I    0    100    0
        10    2014-06-30 19:17:58.000    I    0    100    0
        10    2014-06-30 20:37:46.000    I    0    100    0
    or
         ID             Time                            SN   SD   WE   
    FW
        10    2014-07-01 21:10:33.000    I    0    100    0
        10    2014-07-01 21:11:06.000    O    0    100    0
        10    2014-07-02 20:53:36.000    I    0    100    0
        10    2014-07-02 20:53:38.000    I    0    100    0
        10    2014-07-02 20:54:33.000    O    0    100    0
        10    2014-07-02 20:54:41.000    O    0    100    0
        10    2014-07-02 20:55:22.000    o    0    100    0
    to be
        ID             Time                            SN   SD   WE   
    FW
        10    2014-06-30 19:17:37.000    I    0    100    0
        10    2014-06-30 20:37:46.000    I    0    100    0
    and
        ID             Time                            SN   SD   WE   
    FW
        10    2014-07-01 21:10:33.000    I    0    100    0
        10    2014-07-02 20:53:36.000    I    0    100    0

    i think this
    SELECT *
    --DELETE t
    FROM NEWFP.dbo.CHECKINOUT t
    WHERE EXISTS (
    SELECT 1
    FROM NEWFP.dbo.CHECKINOUT
    WHERE USERID = t.USERID
    AND CHECKTIME < t.CHECKTIME
    AND CHECKTIME >= DATEADD(minute,-5,t.CHECKTIME)
    Once you're happy that it gives you the required records just comment the SELECT *, uncomment the DELETE part and execute
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Delete record from the form and from the database

    hi,
    i want delete record from the form and the database ,but the record is only delete from the from !!!
    this is my code :
    if //condition then
    delete_record;
    commit;
    end if ;
    Any solutions ??
    thnx

    You have unique key field(s) on the table you are trying to insert which actually restricts you from inserting the same value again.
    When you are deleting the record and issue commit there is a record to be inserted in the table which is a duplicate that's why you are getting this unique error.
    As oracle is not able to insert your commit fails and stops your deletion of record from table

  • I need the code to delete record in the database not in the form???

    I need the code to delete record in the database not in the form...
    because when i execute a form always insert the datas in the data base but i want insert value on a text file and delete in the data base the record whith this value of text file.
    i'm spanish an my english is bad sorry.
    thank, javier

    Well, I fail to understand why you want to complicate easy things, but anyway you can do that by using TEXT_IO within Forms to create text file (see Forms builder help), and UTL_FILE package to read it within Pl/Sql : you could create a stored procedure, and call it from Forms passing the file name as parameter. See UTL_FILE documentation

  • Details: Numbers not translating an Excel document with column headings where the text is rotated counter clockwise 90 degrees with-in the cell.  Can you tell me how I can rotate the contents with-in a cell?

    Details: Numbers not translating an Excel document with column headings where the text is rotated counter clockwise 90 degrees with-in the cell.  Can you tell me how I can rotate the contents with-in a cell?

    Numbers does not have rotated text within cells.  You can place a text box over the cell that has rotated text but you cannot rotate text within a cell.

  • Query to delete row where column value contains alphabets

    Hi,
    Could anyone please help me to get this query work.
    Query to delete row where column value contains alphabets.
    DELETE  FROM BIN_ITEM WHERE order_nmb LIKE '%[A-Z]%' || LIKE '%[a-z]%'
    Thanks and Regards,
    Deekay.

    RaminHashimzadeh wrote:
    SELECT order_nmb FROM BIN_ITEM WHERE regexp_count(order_nmb,'[0-9]') = 0
    Ramin Hashimzade
    But that won't reject strings like 'gfgG%dgh' which aren't pure alphabetic.
    Try:
    with test_data as (
    select 'ghTYJYEhdfe' str from dual
    union
    select 'dfF5ssd' from dual
    union
    select 'rgth*dgheh' from dual
    union
    select 'ggf{' from dual
    union
    select 'rwhrhrh' from dual
    select  *
    from test_data
    where regexp_instr(str,'[^[:alpha:]]')=0;

  • I delete files but the available space does not change.

    I delete files but the available space does not change.
    In fact, the space even decreases after deleting attachments and the list of incoming email is empty.
    What happened? Help!

    Fixed.

  • Table where the VAT value is stored

    Hello!
                          Could any one tell me where the VAT value is stored for the particular matnr. I am searching the table KONH- KSCHL where the value is stored at JVAT. but there was 40% of the matnr only having JVAT value.I am taking the price from KONH.So from where i have to take the VAT value.
    -M.Suba

    For excise details you will have to use J_1iexchdr, J_1iexcdtl,
    For Tax related data use KONV
    Thanks & Regards
    JP

  • After I sync my iphone, I lost some of my notes, I dont know where the rest of my notes went..

    After I sync my iphone 3G to my Macbook, I lost some of my notes, I dont know where the rest of my notes went...

    You're welcome.  Some carriers allow customers to download copies of voicemails from your cellular account on their website.  You could contacts yours to see if this is possible.  If not, you would have to use 3rd party software to copy it from the phone to your computer, such as Touch Copy (pc or mac) or PhoneView (mac only).

  • MDSModelDeploy Operation Failed, clone cannot be deployed, The Attribute Value is not valid

    I've created a model containing a customer entity with various domain based attributes.  I've populated the entities via a combination of manual entry and the staging tables.  In the source system I have approx 950 customer records, all of which
    fail validation on the source system as some of the attributes will be maintained only in MDS and are not in the source systems I'm pulling the initial data from.
    I ran the MDSModelDeploy.exe to create a package containing data on the source system.  I then ran the package to apply the package using the -deployclone option on my target system.  I piped the output into a flat file for review.
    Here is the error I'm receiving.
    MDSModelDeploy operation failed. Elapsed time: 00:01:00.2314612
    Error:
    A clone of the "Subzero_1" model cannot be deployed.
    An error occurred while processing message request type 'EntityMembersMergeRequest'. See exception details for more information.
    Package deployment failed with 344 errors
    The attribute value is not valid.
    The attribute value is not valid.   (repeated 344 times)
    Any ideas what the issue might be?  I have tried verbose logging as well and did not find anything that would point me in the direction of the problem.  The end result was that the model was not deployed to the target.
    I have also created a package without data, deployed that, then applied the data.  This gets the model to the target and the data also appears to be there but I did receive this error on the deployupdate.
    This is on SQL Server 2012.

    I am seeing the same error. Created a model, Cloned the model. Made changes to the clone (Schema and Data), and used MDSModelDeploy UpdateModel to update the primary (not cloned) model.  In looking at the log, I see the error shown below, but I do not
    see anything that points to what was happening at the time.
    I tried running a SQL trace to see if one of the SQL commands received an error, but none of the commands did.
    In looking at the model that was updated, I can see all of the schema changes were made, and most of the data was updated. There is one table that did not update completely. The attributes in the table consist of Domain Specific and text attributes only. 
    I also verified that everything on both models was validated before starting.
    In the weblog I see the error listed below, but there is nothing in the data that would match that value 
    Not sure were to go from here....
    Chad
    --- MDSMODELDEPLOY ERROR RECEIVED ---
    MDS Error: 0 : Microsoft.MasterDataServices.WebUI.ServiceAdapterObjectInvalidException: An error occurred while processing message request type 'EntityMembersMergeRequest'. See exception details for more information.
       at Microsoft.MasterDataServices.WebUI.ServiceAdapter.InspectResponseForErrors(MessageRequest request, MessageResponse response)
       at Microsoft.MasterDataServices.WebUI.ServiceAdapter.ExecuteRequest[TRequestType,TResponseType](MdmServiceOperation`2 operation, TRequestType request)
       at Microsoft.MasterDataServices.WebUI.ServiceAdapter.DoEntityMembersMerge(EntityMembers entityMembers)
       at Microsoft.MasterDataServices.Deployment.ModelDeployer.BatchEntityMembersMerge(Collection`1 masterData, Boolean membersOnly, Int32 batchSize, Int32 totalBatches, Collection`1 errors)
       at Microsoft.MasterDataServices.Deployment.ModelDeployer.UpdateData(Collection`1 masterData, Warnings errorsAsWarnings)
       at Microsoft.MasterDataServices.Deployment.ModelDeployer.DeployUpdate(Package package, Boolean includeData, Identifier targetVersionId)
       at Microsoft.MasterDataServices.Deployment.Utility.ModelDeploy.DeployUpdate(String serviceName, String packageFile, String versionName)
       at Microsoft.MasterDataServices.Deployment.Utility.ModelDeploy.Main(String[] args)
        DateTime=2014-02-06T16:03:17.8405277Z
    -- WEB ERROR RECEIVED --
    MDS Verbose: 0 : Unable to convert value of query string parameter Id = VID to an integer
        DateTime=2014-02-06T17:18:00.7367274Z

  • Data type of the base attribute or the base value does not match...

    ...the assigned expression.
    Hello all,
    I always get the Error
    +<ERROR+
    TEXT="'DWH.CUB_REGISTRATIONS_AW.REGISTRATIONS': XOQ-02517: Der Datentyp des Basisattributs oder der Basisgröße stimmt nicht mit dem zugeordneten Ausdruck überein.
    XOQ-01400: Ungültige Metadatenobjekte"/>
    The English message must be something like this:
    The data type of the base attribute or the base value does not match the assigned expression.
    when I run my mapping. The attribute REGISTRATIONS is NUMERIC (12,2) in the Cube and I map a NUMERIC(12,2) constant in it.
    I use a simple OWB-Mapping for loading, but I don't understand why it doesn't function. Other mappings where the attributes are out of a
    table I put in a cube are running well.
    I tried different things, but nothing fixed my problem. Any idea ?
    Thanks a lot for help
    Michael

    Technically this is a 'warning' from the server, not an 'error'. This means that the change you made should have been submitted, but you get an warning message on the client. AWM would suppress this warning, but evidently OWB does not. Can you switch to use AWM?
    Here is the definition of the warning along with 'cause' and 'action' sections. (Unfortunately these sections are not translated into German for some reason.)
    >
    02517, 0, "The data type \"%(1)s\" of the base attribute or base measure is different from the mapped expression \"%(2)s\"."
    // *Cause: Either the base attribute or base measure with the mapped expression was set to an inconsistent data type, or it was mapped to an expression of a different data type from its fixed data type.
    // *Action: When changing a mapped expression for a base attribute or base measure, ensure that the expression has the same data type; otherwise, set the data type of the base attribute or base measure to NULL first. When a base attribute or a base measure has an existing mapped expression, do not set it to a different data type.
    >
    It is probably safe to ignore this warning, but if you can post the relevant XML for the cube, then will probably be able to spot the problem. I assume that REGISTRATIONS is a measure in the cube CUB_REGISTRATIONS_AW, so this is what you can look for in the XML:
    (1) The definition of the base measure along with the datatype. It should be something like this
    <Measure>
      <BaseMeasure
        SQLDataType="NUMBER(12,2)"
        ETMeasureColumnName="REGISTRATIONS"
        Name="REGISTRATIONS">(2) The mapping info for the measure, which should looks something like this:
    <MeasureMap
      Name="REGISTRATIONS"
      Expression="...">
      <Measure Name="REGISTRATIONS"/>
    </MeasureMap>I don't know if you can get the XML directly from OWB. If not, then DBMS_CUBE.EXPORT_XML should work (assuming you are in 11.2). You could also attach AWM and save the cube to an XML template.

  • OSD fails during WinPE Install drivers - "The hash value is not correct"

    Hello everyone,
    We are facing a strange problem during OSD for one of the hardware models. We are on SCCM 2012 R2, and mainly build Windows 7
    x86 machines on various Lenovo models.
    I can see this problem I have encountered has been discussed elsewhere on this forum (especially SCCM 2007 threads) but not really sure what I have
    observed is the issue being discussed. Here is the problem....<o:p></o:p>
    We have a laptop (Lenovo x240) which has been building perfectly fine for as long as I can remember. However since last 2 days when I try to build
    the same model, we get the above error during the driver installation stage (in WinPE).<o:p></o:p>
    I referred to some of the other threads and MS blogs where they say file names with extended ASCII character may break the hash of the files (packages)
    being downloaded during OSD resulting in the error(http://blogs.technet.com/b/smsandmom/archive/2008/10/09/configmgr-2007-smsts-error-hash-could-not-be-matched-for-the-downloaded-content.aspx).
    The point is I have manually gone into the Command prompt (F8) during driver downloading stage (right after apply OS image) and checked that the drivers are getting downloaded fine (but there is not enough time for me to check individual sub folders for the
    extended ascii character problem). When it comes to installing the drivers, the TS fails and immediately the whole of the driver packages folder under D:\_SmsTaskSequence\Packages\PackageID folder becomes empty.
    There is nothing much logged in the ts log either.<o:p></o:p>
    Any thoughts? The only thing that has changed in our environment in the last 2 weeks is that we have upgraded from SCCM
    2012 SP1 to R2(CU3). All the other models have built ok since and only X240 is running into this issue.
    Would recreating the driver pack be an option here? I also understand that we also can configure the TS to refer to the package media directly from
    the DP share (instead of downloading) but we would rather not get into that at this stage as we have not tested the TS with that configuration (it might open another can of worms with package command lines etc.)
    One more point - This "The hash value is not correct" error message is only logged on the SCCM status messaging system (which can be viewed
    under the Monitoring wunderbar - Status Message Queries). I do not find it on the ts log file interestingly.
    Any help is much appreciated.<o:p></o:p>

    I've only seen this once before in a ConfigMgr 2012 RTM environment and after fighting it for a few days I ended up simply recreating the driver packages.
    -Nick O.

  • Business Rule err The following value is not valid for the run time prompt.

    Hyperion Planning v 9.3.3
    I have created a new BR with 2 local variables (created at the time of the BR), Variables are set as run time prompts. They are created as "Member" (not Members). The BR basically does a calc dim on dense and Agg on Sparce other than the prompt on Entity and Version dimensions. The entity variable has a limit on level 0 of the dimension. The Version variable limits to the input (Submit and Sandboxes)
    The BR is associated in Planning with an input web form. Entity and Version are in the page. Is set to Run on Save and Use members on form.
    If the run time prompts Hide boxes are checked, an empty Prompt pops up with only a Submit button. Click the button and an error comes up: "The following value is not valid for the run time prompt it was entered for:. But it does not indicate what member - just ends in the :.
    The BR will run sucessfully only if the Run-time prompt is not hidden - "Hide" in the BR is unchecked. So the syntax and logic of the BR is correct and security should not be an issue.
    The client wants no prompt. In production we have similar situations in which the BR works with the Web Forms without a prompt.
    What am I doing wrong - I have tried restarting the Planning service and the EAS service.

    My preferred method of doing this is:
    1. In business rule, do not hide the run-time prompts. This makes it easy to validate the business rule as you are building it. I only use Global Variables.
    2. On the form, have business rule set to run on save, use members on data form and hide prompt.
    Check that in the business rule, for the variables (Run-Time prompts), that they are all in use. If not, delete them from the business rule. Are all your variables global? Are some local and some global? This could be the issue.
    Deanna

  • Up next doesn't seem to work properly with multiple speakers over airplay. The status bar on the computer shows the song playing, but not over airplay. When I restart the song it plays, but the same thing happens when the next song cues up. Any ideas?

    Up next doesn't seem to work properly with multiple speakers over airplay. The status bar on the computer shows the song playing, but not over airplay. When I restart the song it plays, but the same thing happens when the next song cues up. Any ideas?

    Hey briannagrace96,
    Welcome to Apple Support Communities! I'd check out the following article, it looks like it applies to your situation:
    iPod: Appears in Windows but not in iTunes
    http://support.apple.com/kb/ts1363
    You'll want to go through the following troubleshooting steps, and for more detail on each step follow the link to the article above:
    Try the iPod troubleshooting assistant:
    If you have not already done so, try the steps in the iPod Troubleshooting Assistant (choose your iPod model from the list).
    If the issue remains after following your iPod's troubleshooting assistant, follow the steps below to continue troubleshooting your issue.
    Restart the iPod Service
    Restart the Apple Mobile Device Service
    Empty your Temp directory and restart
    Verify that the Apple Mobile Device USB Driver is installed
    Change your iPod's drive letter
    Remove and reinstall iTunes
    Disable conflicting System Services and Startup Items
    Update, Reconfigure, Disable, or Remove Security Software
    Deleting damaged or incorrect registry keys
    Take care,
    David

  • Why the default value is not the Oracle recommended?

    Why the default value is not the Oracle recommended?
    In Oracle 10g, the default alocated unit of Oracle ASM is 1MB. But the Oracle ducumentation states that "To ensure a higher probability of one
    logical I/O resulting in no more than one physical I/O, the minimum stripe depth should be at least twice the Oracle block size". ---See Performance Tuniing Guide (10g10.2 Page8-3.
    It's inconsistent. What is right way?

    >
    Why the default value is not the Oracle recommended?
    In Oracle 10g, the default alocated unit of Oracle ASM is 1MB. But the Oracle ducumentation states that "To ensure a higher probability of one
    logical I/O resulting in no more than one physical I/O, the minimum stripe depth should be at least twice the Oracle block size". ---See Performance Tuniing Guide (10g10.2 Page8-3.
    It's inconsistent. What is right way?
    The default database blocksize of 10g is 8k.
    >
    8 * 128 = 1024
    128 >= 2
    At least twice the size does not mean exactly the doubled size.
    There is no contradiction between the documentation and your observation in this case.
    Kind regards
    Uwe
    http://uhesse.wordpress.com

Maybe you are looking for

  • Passing a Parameter to JSF / ADF

    Hi, I am using the MVC architecture with the model provided by ADF business components and the view/controller provided by JSF. Any help would be great since this project was due 'yesterday'. Thanks. I want going to pass a few parameters to a JSF (ex

  • Firefox keeps crashing outside safe mode (resetting, uninstalling-reinstalling, & disabling all add-ons do not help)

    I have actually been having this issue for over a year now with the previous versions. The browser always crashes right after I start it, but it seems work well in safety mode. I have tried resetting the Firefox, disabling all the add-ons in safety m

  • New 7100i - Provisioning for Multiple Phone Lines

    I just received a new 7100i from Nextel, and absolutely need support for two phone lines.  Although Nextel assures me that this is supported, I'd expect this to be documented somewhere in the User Manual.  It's not, and I am wondering whether Sprint/

  • Can I transfer files from an external hard drive to iCloud?

    I have been looking for a great alternative to backing up my all of my photos (I am a photographer). I own two externals that I'd like to get certain files backed up once more in another place just to make sure they are safe. So can I transfer my pho

  • Importing Flash animation into Catalyst

    Is Catalyst yet capable of importing and using movie clips made in flash, or it can only use static images on layers from Photoshop and Illustrator?  If not, I'd like to say that I really like the idea of making Flash animation movie clips how I usua