+ Reply to Thread
Results 1 to 8 of 8

Thread: Cell Check With Numbers, Symbols and Characters

  1. #1
    Registered User
    Join Date
    03-22-2011
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Cell Check With Numbers, Symbols and Characters

    Hello,

    I have spent some time searching for a past thread related to my question and have only found a few forums with similar questions but not the same. I then tried using some VBA online lessons and such but have had no luck - I appreciate any help provided.

    I have a spreadsheet that is already sorted and does not require further sorting. I essentially require the macro to take the contents of a cell and check it with the cell below it. The problem is the cells contain a mix of mostly numbers, symbols, and a consistent capital letter.

    '1120500+1256-R
    '1086900+1247-R
    What would be the command to check these two strings?

    Thanks a million,

    Alex
    Last edited by BioEngineer; 03-22-2011 at 10:52 AM. Reason: posted too soon

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: Cell Check With Numbers, Symbols and Characters

    Welcome to the forum.

    Check what?
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    03-22-2011
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Cell Check With Numbers, Symbols and Characters

    Hey shg - sorry for the lack of information within my question.

    When I say check it would consist of checking to see if the two strings are the same or different.

    If same, conduct a multiplication operation, if different, take an average of the multiplication operations within the range where the cells were the same

                       COLUMN 1               COLUMN 2                 COLUMN 3
    
    ROW 2     1120500+1256-R                5.2                             2.4
    ROW 3     1120500+1256-R                5.0                             2.5
    ROW 4     1120500+1256-R                4.5                             2.4
    ROW 5     1086900+1247-R                30.0                           5.0
    ROW 6     1086900+1247-R                30.0                           5.5
    ie) Some sort of loop that compares C1R2 with C1R3, if they are the same, multiply C2R2 with C3R3. If C1R4 does not equal C1R5, averages the multiplication operation between C2 and C3 in the rage where column 1 is the same.

    I think i know how to program the loop but I'm unsure of how to to do the check within column 1 and then when they are dissimilar, average the multiplication operation within the range where they were similar.

    Thanks a million for any help.

    Regards,

    Alex
    Last edited by shg; 03-22-2011 at 12:30 PM. Reason: deleted quote

  4. #4
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: Cell Check With Numbers, Symbols and Characters

          ------A------- --B--- --C-- ---D--- ------------------E------------------
      1   Col 1          Col 2  Col 3                                              
      2   1120500+1256-R   5.2   2.4    12.5  D2 and down: =IF(A2=A3, B2*C2, "???")
      3   1120500+1256-R   5.0   2.5    12.5                                       
      4   1120500+1256-R   4.5   2.4   ???                                         
      5   1086900+1247-R  30.0   5.0   150.0                                       
      6   1086900+1247-R  30.0   5.5   ???
    If C1R4 does not equal C1R5, averages the multiplication operation between C2 and C3 in the rage where column 1 is the same.
    I don't understand that part, hence the "???" in the formula.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    03-22-2011
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Cell Check With Numbers, Symbols and Characters

    Thank you for your response.

    In row 4, it would conduct the multiplication as normal ie) ??? = 10.8 but the average would be taken on all "1120500+1256-R"
    Hence the check would be to ensure the range of 1120500+1256-R is calculated.

    The average would be taken across all 1120500+1256-R.

    Does that clarify anything?
    Last edited by shg; 03-22-2011 at 12:30 PM. Reason: deleted quote

  6. #6
    Forum Guru Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    5,590

    Re: Cell Check With Numbers, Symbols and Characters

    Maybe ?
    In D2
    =IF(A2=A3,B2*C2,SUMIF($A1:D$2,A2,$D1:D$2)/COUNTIF($A1:D$2,A2))
    Drag/Fill Down

    or in 2007 and above
    =IF(A2=A3,B2*C2,AVERAGEIF($A1:D$2,A2,$D1:D$2))

    [EDIT]
    Just saw your post
    Try
    =IF(A2=A3,B2*C2,(SUMIF($A1:D$2,A2,$D1:D$2)+B2*C2)/(COUNTIF($A1:D$2,A2)+1))

    Hope this helps
    Last edited by Marcol; 03-22-2011 at 12:09 PM.
    If you need any more information, please feel free to ask.

    However, if this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody! ....
    Also
    If you are satisfied by any members response to your problem please consider using the small Star icon botom left of thier post to show your appreciation.

  7. #7
    Registered User
    Join Date
    03-22-2011
    Location
    Calgary, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Cell Check With Numbers, Symbols and Characters

    Yes, I believe that would work, thank you!
    Last edited by shg; 03-22-2011 at 02:05 PM. Reason: deleted spurious quote

  8. #8
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    Re: Cell Check With Numbers, Symbols and Characters

    BioEngineer, please don't quote whole posts -- it's just clutter.

    Thanks.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0