Sida loo tirtiro saf kasta ama saf kasta Nth ee Excel

  • La Wadaag Tan
Michael Brown

Tababarkan gaaban wuxuu sharxayaa sida loo tirtiro saf kasta oo Excel ah iyadoo la shaandheynayo ama koodka VBA. Waxaad sidoo kale baran doontaa sida loo saaro 3rd, 4th ama mid kasta oo safka Nth. > 3>

Waxaa jira xaalado badan marka laga yaabo inaad u baahato inaad tirtirto safafka kale ee xaashida shaqada ee Excel. Tusaale ahaan, waxaa laga yaabaa inaad rabto inaad hayso xogta xitaa toddobaadyo (safka 2, 4, 6, 8, iwm.) oo aad u guurto dhammaan toddobaadyada khayaaliga ah ( safafka 3, 5, 7 iwm.) xaashi kale.

Guud ahaan, tirtirida saf kasta oo Excel ah waxay hoos ugu dhacdaa xulashada safafka kale. Marka safafka la doorto, hal istaroog oo ku yaal badhanka Delete ayaa ah waxa ay qaadanayso. Dheeraad ah oo ku saabsan maqaalkan, waxaad baran doontaa dhowr farsamooyin si aad si dhakhso ah u doorato oo aad u tirtirto mid kasta oo kale ama saf kasta Nth ee Excel.

Sida loo tirtiro saf kasta oo kale oo Excel ah adoo sifeynaya

Nuxur ahaan, habka caadiga ah ee lagu tirtiro saf kasta oo Excel ah waa tan: marka hore, waxaad shaandheysaa safafka kale, ka dibna dooro, oo tirtir dhammaan hal mar. Tallaabooyinka faahfaahsan ayaa raacaya xagga hoose:

    >> Tiir madhan oo ku xiga xogtaada asalka ah, geli isku xigxiga eber iyo kuwa. Waxaad si dhakhso ah taas u samayn kartaa adiga oo ku dhejiya 0 unugga kowaad iyo 1 unugga labaad, ka dib koobiyaynta labada unug ee hore oo ku dheji hoos tiirka ilaa unugga u dambeeya ee xogta leh.

    Haddii kale, waxaad isticmaali kartaa qaacidadan:

    > =MOD(ROW(),2)
> Caqliga qaaciddada waa mid aad u fudud: shaqada ROW waxay soo celisaa lambarka safka hadda jira, shaqada MODwuxuu u qaybiyaa 2 oo ku soo celiyaa inta soo hadhay oo lagu soo koobay tirada.

Natiijo ahaan, waxaad haysataa 0 dhammaan safafka (sababtoo ah waxay u qaybsan yihiin 2 siman oo aan ka hadhin) iyo 1 dhammaan safafka khayaaliga ah:

11>
  • Waxay kuxirantahay inaad rabto inaad tirtirto xitaa ama safafka khayaaliga ah, shaandhayso kuwa ama eber.

    Si taas loo sameeyo, dooro unug kasta oo ku jira tiirka Caawintaada, tag Data tab > Sort and Filter group, oo dhagsii Filter badhanka. Fallaadhaha shaandhada hoos-u-dhaca ayaa ka soo bixi doona dhammaan unugyada madaxa. Waxaad gujisaa badhanka fallaadha ee tiirka Caawinta oo calaamee mid ka mid ah sanduuqyada:

    • 0 si aad u tirtirto xataa safafka
    • > 1 si aad u tirtirto safafka khayaaliga ah
  • Tusaalahan, waxaan ka saareynaa safafka leh "0" qiyamka, si aan u shaandheyno iyaga:

    > Hadda oo dhammaan "1" saf waa qarsoon yihiin, dooro dhammaan safafka "0" ee muuqda, midig-guji xulashada oo dhagsii Delete Saf:

  • Tallaabadan kore waxay kaa tagtay miis faaruq ah , laakiin ha werwerin, safafka "1" ayaa weli jira. Si aad iyaga mar kale u muuqdaan, si fudud uga saar auto-filter adigoo gujinaya Filter badhanka mar labaad:

    >

    >
  • >Qaabka ku jira tiirka C wuxuu dib u xisaabiyaa safafka soo hadhay, laakiin uma baahnid. Hadda waxaad si badbaado leh u tirtiri kartaa tiirka Caawinta:

    >

    Natiijadu waxay tahay, toddobaadyada kaliya ayaa ka haray xaashida shaqada, toddobaadyadii qallafsanaa way tageen!

    >

    Talo. Haddii aad jeclaan lahayd inaad guurto mid kastasafka kale oo meel kale aado intii aad gabi ahaanba tirtiri lahayd, marka hore koobbi safafka la sifeeyay oo ku dheji meel cusub, ka dibna tirtir safafka la sifeeyay.

    Sida loo tirtiro safafka kale ee Excel ee leh VBA

    Haddii aadan rabin inaad waqtigaaga ku lumiso hawl yar sida tirtiridda saf kasta oo kale ee xaashidaada Excel, VBA macro-ga soo socda ayaa kuu habayn kara nidaamka:

    Sub Delete_Alternate_Rows_Excel() Dim SourceRange Sida Range Set SourceRange = Application.Selection Set SourceRange = Application.InputBox("Range:"", "Select the range" Application.ScreenUpdating = Been loogu talagalay RowIndex = SourceRange.Rows.Count - (SourceRange.Rows.Count Mod 2) Ilaa 1 Step -2 Deji FirstCell = SourceRange.Cells(RowIndex, 1) FirstCell.EntireRow.Delete Next Application.ScreenUpdating = Run Dhammaadka Haddii Dhamaadka Sub

    Sida loo tirtiro saf kasta oo kale oo Excel ah iyadoo la adeegsanayo makro

    I Geli makro xaashidaada shaqo sida caadiga ah adigoo isticmaalaya Visual Basic Editor:

    1. Riix Alt + F11 si aad u furto daaqada Visual Basic for Applications
    2. > Dusha sare ee liiska, dhagsii Insert > Module , oo ku dheji macro-ga sare Module > >Riix furaha F5 si aad u socodsiiso makro.
    3. Wadahadal ayaa soo baxaya oo ku sheegi doona inaad doorato tiro kala duwan. Dooro miiskaaga oo gujiOK:

      >

    4. >
    >Waa la sameeyay! Saf kasta oo kale oo ka mid ah tirada la doortay waa la tirtiray:>>> Sida loo tirtiro safka Nth kasta ee ExcelHawshan, waxaanu sii kordhinaynaa shaandhaynta farsamo aan u isticmaalnay in aan ka saarno saf kasta oo kale. Farqiga ayaa ku jira qaacidada ay shaandhayntu ku salaysan tahay:MOD(ROW()- m, n)

    Halkan:

      9> m waa nambarka safka unugga kowaad ee xogta laga jaray 1
    • n waa safka Nth ee aad rabto in aad tirtirto

    Aynu nidhaahno xogtaadu waxay ku bilaabataa safka 2aad oo aad rabto inaad tirtirto safkii 3aadba. Marka, qaacidadaada n waxay la mid tahay 3, iyo m waxay la mid tahay 1 ( safka 2 laga jaray 1):

    =MOD(ROW() - 1, 3)

    >Haddii xogtayadu ku bilaabantay safka 3, ka dib mwuxuu la mid noqonayaa 2 ( safka 3 laga jaray 1), iyo wixi la mid ah. Sixitaan waxaa loo baahan yahay in si isdabajoog ah loo tiriyo safafka, laga bilaabo lambarka 1.

    Waxa qaacidadu ay qabato waa u qaybi nambarka safka qaraabo ah 3 oo soo celi inta soo hartay qaybinta ka dib. Xaaladeena, waxay soo saartaa eber saf kasta oo seddexaad ah sababtoo ah tir kasta oo seddexaad waxay u qaybisaa 3 iyada oo aan la haynin (3,6,9, iwm):

    >

    Haddana, adiga Samee tillaabooyinka horey loo yiqiin si aad u shaandheyso "0" saf:

    1. Dooro unug kasta oo miiskaaga ku jira oo guji Filter badhanka Data >
    2. Sifee tiirka Caawinta si aad u muujiso kaliya "0" qiyamka.
    3. Dooro dhammaan safafka "0" ee muuqda, midig-guji oo dooro Tirtir Safka ee macnaha guud.
    4. Ka saar shaandhada ooTirtir tiirka Caawinta
    5. >

      >

      >Si la mid ah, waxaad tirtiri kartaa saf kasta oo 4th, 5th ama Nth kasta oo Excel ah.

      Talo. Haddii ay dhacdo in aad u baahato in aad ka saarto safafka xog aan khusayn, casharka soo socda ayaa ku caawin doona: Sida loo tirtiro safafka ku salaysan qiimaha unugga .

    Michael Brown waa xamaasad tignoolajiyada u heellan oo xiise u leh fududaynta hababka adag iyadoo la adeegsanayo aaladaha software. In ka badan toban sano oo waayo-aragnimo ah oo ku saabsan warshadaha teknoolajiyada, wuxuu ku horumariyay xirfadihiisa Microsoft Excel iyo Outlook, iyo sidoo kale Google Sheets iyo Docs. Blog-ga Michael wuxuu u heellan yahay inuu la wadaago aqoontiisa iyo khibradiisa dadka kale, isagoo siinaya tabo-fudud oo la raaco iyo casharro lagu horumarinayo wax soo saarka iyo hufnaanta. Haddii aad tahay xirfadle khibrad leh ama bilow ah, Michael's blog wuxuu bixiyaa fikrado qiimo leh iyo talooyin wax ku ool ah si aad uga faa'iidaysato qalabkan software-ka ah ee muhiimka ah.