Results 1 to 3 of 3

Combining mutiple IF and CountIF statements to help sort data

Threaded View

frekemeister Combining mutiple IF and... 08-28-2013, 05:48 AM
martindwilson Re: Combining mutiple IF and... 08-28-2013, 06:11 AM
frekemeister Re: Combining mutiple IF and... 08-28-2013, 07:33 AM
  1. #1
    Registered User
    Join Date
    08-28-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Post Combining mutiple IF and CountIF statements to help sort data

    Hi,
    I have a large spreadsheet with a quarters worth of financial transactions. One of the columns contains a description, which is overly complicated and mostly irrelevant. What I would like to have is an additional column that can search for keywords within the descriptions column and then output the relevant text to the new column. So I guess, grouping several description keywords into group. I can then filter on the new group names far easier.

    For example one description reads “OS PAYPAL,processed on 29.07.13” all I am bothered with is the PAYPAL detail in this line and it needs to be translated in the new column to TAKINGS

    I have managed to put together the following VB, which works great, however it outputs the keywords to different columns. I have tried putting the .Formula statements within the same With/End With group but only the last run .Formula sticks in the correct column.

    My question is, can all of these Ifs/CountIFs be added into one .Formula, or is there a better way of doing it?

    Sub Sorting()
        With Range("G1:G16357").Offset(, 5)
            .Formula = "=IF(COUNTIF(RC[-5],""*test1*"")+COUNTIF(RC[-5],""*test2*"")+COUNTIF(RC[-5],""*test3*"")+COUNTIF(RC[-5],""*test4*"")+COUNTIF(RC[-5],""*test5*"")+COUNTIF(RC[-5],""*test6*""),""TAKINGS"","""")"
                    
        End With
        With Range("G1:G16357").Offset(, 6)
            .Formula = "=IF(COUNTIF(RC[-6],""*test7*"")+COUNTIF(RC[-6],""*test8*"")+COUNTIF(RC[-6],""*test9*""),""great"", """")"
        End With
        With Range("G1:G16357").Offset(, 7)
          .Formula = "=IF(COUNTIF(RC[-7],""*bon*""),""BON"","""")"
        End With
        With Range("G1:G16357").Offset(, 8)
            .Formula = "=IF(COUNTIF(RC[-8],""*income*""),""INCOME"","""")"
        End With
        With Range("G1:G16357").Offset(, 9)
            .Formula = "=IF(COUNTIF(RC[-9],""*paye*""),""PAYE"","""")"
        End With
        With Range("G1:G16357").Offset(, 10)
            .Formula = "=IF(COUNTIF(RC[-10],""*Payroll*""),""Payroll"","""")"
        End With
        
    End Sub
    Last edited by frekemeister; 08-28-2013 at 07:33 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 05-23-2012, 11:24 AM
  2. Excel 2007 : combining two countif statements
    By stephsmom in forum Excel General
    Replies: 7
    Last Post: 02-23-2012, 04:49 PM
  3. combining two countif statements
    By stephsmom in forum Excel General
    Replies: 3
    Last Post: 02-23-2012, 12:51 PM
  4. Combining COUNTIF statements with different criteria
    By Darlo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-10-2007, 02:32 PM
  5. Combining mutiple columns into one column
    By noelcantona in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-16-2005, 02:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1