Results 1 to 2 of 2

Thread: CountIf Including String

  1. #1

    Thread Starter
    Frenzied Member agmorgan's Avatar
    Join Date
    Dec 2000
    Location
    Lurking
    Posts
    1,383

    CountIf Including String

    I have a column of IDs and I want to check if there are duplicates in this column as I loop through it.
    However, I need to ignore suffixes to the data.
    e.g.
    Code:
    123 - false
    124 - true
    124 - true
    125 - true (matches 125_1 and 125_2)
    125_1  - true (matches 125 and 125_2)
    125_2  - true (matches 125 and 125_1)
    126_1  - true (matches 126_2)
    126_2  - true (matches 126_1)
    127 - false
    Can I use CountIfs for this?
    Or maybe multiple CountIf's.

    I'm concerned that if I have to write it myself in VBA it wont be as efficient as the built in functions

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: CountIf Including String

    This is the most simplest way to do it...

    1) Sort the column in ascending order (Say the data is from A1 and down)
    2) Type this formula in B2 and copy it down

    =IF(LEFT(A2,3)=LEFT(A1,3),"True","False")

    Hope this helps...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width