Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9154707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:28:19+00:00 2026-06-17T12:28:19+00:00

I have question that when I want to compare between a1= 1.3 b1= 3

  • 0

enter image description here

I have question that when I want to compare between a1= 1.3 b1= 3 and a2= 1.3 b2= 2 on excel for example =IF(a1>a2,"Yes",IF(a1=a2,IF(b1>b2,"Yes","No"),"no"))

First time it’s okay, but then I changed value from b1 =1 it changed to “no” then I changed it back to b1= 3 it’s still “no”

I think it concern on format in the cell.

Another concern is if I use like 1.3.1 compare to 1.3.1.2 it doesn’t have any problem, but when I use only 1.3 (one decimal point) it always have problem

It’s hard to explain you should try to compare between x.x and x.x.x also if you have a good another VBA code to compare version number

It like 1 decimal point excel see as number, but many decimal point excel see as text

How do I fix this (I have try change to text format but it work 1 time after you change value in cell it’s go back to error.)

Due to my English is poor. to make it clearer "How do i make x.x see as text so that i can compare with x.x.x :) "

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:28:19+00:00Added an answer on June 17, 2026 at 12:28 pm

    Here is an article/ post you may want to check. The first impression I had on your question is that you may be trying to do a version number comparison. Length and number of dot delimiters in your text could matter greatly.for now please check this,

    http://www.dbforums.com/microsoft-excel/1670840-compare-version-numbers-return-highest-value.html

    Or else you may try the log as well:

    =A1*10^(4-INT(LOG(A1)))

    Or do a replace on trailing . dots and surely the second text becomes a decimal:

    E.g. 1.3.4 will be 1.34 and 1.3.4.1.3 will be 1.3413

    1.2.5.6 will be 125.6 and 1.2.4.6.1 will be 124.61

    PS: not front of a machine. Will provide you with another code I have based on split by dot delimiter and compare.

    Edit with a function: this will compare two version numbers with any number of dot points, treating it as a string/text. However in the case of 1.3.1 and 1.21.1 this takes 1.21.1 as the highest number.

    Option Explicit
    
    Function versionNumberComparison(ByRef rng1 As Range, ByRef rng2 As Range) As String
        Dim i As Integer
        Dim arrVersion1 As Variant, arrVersion2 As Variant
        Dim strVer1 As String, strVer2 As String
        Dim bool2 As Boolean, bool1 As Boolean
        Dim x As Long, y As Long
    
        Application.EnableEvents = False
        If Not IsEmpty(rng1.Value) Then
            strVer1 = rng1.Value
            arrVersion1 = Split(rng1.Value, ".")
        Else
            versionNumberComparison = "Version number empty"
            GoTo Zoo
        End If
        If Not IsEmpty(rng2.Value) Then
            strVer2 = rng2.Value
            arrVersion2 = Split(rng2.Value, ".")
        Else
            versionNumberComparison = "Version number empty"
            GoTo Zoo
        End If
    
        If UBound(arrVersion1) > UBound(arrVersion2) Then
            x = UBound(arrVersion1)
            y = UBound(arrVersion2)
        ElseIf UBound(arrVersion1) < UBound(arrVersion2) Then
            x = UBound(arrVersion2)
            y = UBound(arrVersion1)
        Else
            x = UBound(arrVersion1)
            y = x
        End If
    
        i = 0
            While i <= y
                If IsNumeric(arrVersion1(i)) And IsNumeric(arrVersion2(i)) Then
                        If CInt(Trim(arrVersion1(i))) = CInt(Trim(arrVersion2(i))) Then
                            If i = y Then
                                If x <> y Then
                                    If Len(strVer1) > Len(strVer2) Then
                                        bool1 = True
                                        bool2 = False
                                        GoTo PrintOut
                                    Else
                                        bool2 = True
                                        bool1 = False
                                        GoTo PrintOut
                                    End If
                                End If
                            End If
                                bool1 = False
                                bool2 = False
                        ElseIf CInt(Trim(arrVersion1(i))) > CInt(Trim(arrVersion2(i))) Then
                            bool1 = True
                            bool2 = False
                            GoTo PrintOut
                        Else
                            bool2 = True
                            bool1 = False
                            GoTo PrintOut
                        End If
                Else
                    versionNumberComparison = "Enter Valid version numbers"
                    GoTo Zoo
                End If
                i = i + 1
            Wend
    
    PrintOut:
    
        If bool1 Then
            versionNumberComparison = strVer1
        ElseIf bool2 Then
            versionNumberComparison = strVer2
        Else
            versionNumberComparison = "Both the same"
        End If
    
    Zoo:
    Application.EnableEvents = True
    End Function
    

    Output:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a slightly theoretical question that I want to clear up before I
I have a simple question. I have a long std::string that I want to
I feel silly asking this question... Sometimes I have a domain that I want
I have a question that may be quite naive, but I feel the need
I have a question that I'm ashamed to ask, but I'm going to have
I have a question that may sound odd, but being somewhat of a newbie,
I have a question that can I use AS400ConnectionPool in Spring if then pls
I have a question that should be quick and easy for you guys to
I have a question that I just don't feel like I've found a satisfactory
I have a question that's somewhat of an extension of this thread . I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.