+ Reply to Thread
Results 1 to 17 of 17

When Values don't equal Values

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    When Values don't equal Values

    I have two possible routines, and I'm wondering why one is different from the other.

    If I have a column formatted as Text, and I have a value of 000, it displays as "000".
    When I run a vba routine like
    Please Login or Register  to view this content.
    the resultant value is still "000"

    But if I do this:
    Please Login or Register  to view this content.
    the resultant value is "0"

    So value doesn't equal value. How do I get around that?
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: When Values don't equal Values

    First method does not change cell format.
    Second method does convert the cell to “value” format

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: When Values don't equal Values

    So, based on the last comment, if i want the result to be "000", I'd have to do it like so:
    Please Login or Register  to view this content.
    that's a much slower operation. Is there an alternative?

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: When Values don't equal Values

    Quote Originally Posted by jomili View Post

    But if I do this:
    Please Login or Register  to view this content.
    the resultant value is "0"
    It doesn't do that for me in Excel 2016 32bit or Excel 365 64bit
    Rory

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: When Values don't equal Values

    Both versions leave the format as is for me.

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: When Values don't equal Values

    Forgot to mention, my "000" comes from a formula, "=TEXT(Z3,"000")". Maybe that's the difference?
    Attached Files Attached Files
    Last edited by jomili; 11-08-2021 at 02:51 PM.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: When Values don't equal Values

    So, is the cell formatted as Text, or do you just get Text output from the TEXT function?

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: When Values don't equal Values

    Why do you need to go cell by cell, rather than the original bulk operation of:

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: When Values don't equal Values

    TMS, the cell is not formatted as text, so the formula can work.
    Rorya, this is for a specialized macro to convert a filtered range to values.

  10. #10
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: When Values don't equal Values

    I’d suggest you format the cells as text just before replacing the values, and also go area by area rather than cell by cell.

  11. #11
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: When Values don't equal Values

    Rorya,
    I understand what you're saying, but what will that do to any columns that have formulas resulting in a numerical result? If the formula results in a number, and I then format the column as Text, then won't the numbers appear as Text numbers instead of actual numbers?

    And I guess it's best if I show my current macro that I'm trying to repair.
    BTW, I have macros that turn off screen updating, calculations, etc. that are called by this macro. I took those parts out so it wouldn't confuse anyone.
    Please Login or Register  to view this content.

  12. #12
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: When Values don't equal Values

    If you don’t know in advance what kind of data you are dealing with, I’d stick to the copy paste:

    Please Login or Register  to view this content.
    Last edited by rorya; 11-09-2021 at 02:04 PM.

  13. #13
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: When Values don't equal Values

    I agree with copy/paste. But I'm not familiar with "Area" in this context. Is that each contiguous visible area, rather than each individual cell? If so, I agree that should be faster.

  14. #14
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: When Values don't equal Values

    Oh, and I just noticed your double use of Special Cells to take care of the visible. Smooth idea!

  15. #15
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: When Values don't equal Values

    Yes it is. Whether it’s faster will depend on how many of the visible cells are contiguous.

  16. #16
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: When Values don't equal Values

    thanks so much for the help and education. I really appreciate it.

  17. #17
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: When Values don't equal Values

    Glad we could help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 07-07-2020, 06:52 AM
  2. [SOLVED] Return rows based on cols equal certain values and on col top 5 largest values
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2020, 12:12 PM
  3. SUMIF (Or SUMIFS) To Sum Values NOT equal to a RANGE of values
    By Norcal1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-29-2018, 02:11 PM
  4. Determining if Excel values equal Access table values
    By jlynn303 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-25-2014, 09:04 AM
  5. Replies: 1
    Last Post: 09-25-2013, 10:05 AM
  6. [SOLVED] If values in a column are equal, then need to calc average of values in other columns
    By engineerlady in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2013, 02:33 PM
  7. Replies: 3
    Last Post: 09-26-2012, 09:48 AM

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