Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Qt c++ xlsx get maxımum row for calculate average
Forum Updated to NodeBB v4.3 + New Features

Qt c++ xlsx get maxımum row for calculate average

Scheduled Pinned Locked Moved Solved Qt 6
8 Posts 4 Posters 986 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mangekoyuM Offline
    mangekoyuM Offline
    mangekoyu
    wrote on last edited by
    #1

    I'm trying calculate average of some datas. Qxlsx bibrary says use xlsx.write("B9", "=AVERAGE(B3:B5)", lAlign); for calculate average but by end cell not known.
    When I made chart I tried sth kile this and its worked. lineChart -> addSeries(CellRange("C7:C" + maxRow), xlsx.sheet("Sheet1")); max Row is my maximum row number. How can I append my end row to average function? here is library.
    Qxlsx examples folder

    JonBJ 1 Reply Last reply
    0
    • mangekoyuM mangekoyu

      I'm trying calculate average of some datas. Qxlsx bibrary says use xlsx.write("B9", "=AVERAGE(B3:B5)", lAlign); for calculate average but by end cell not known.
      When I made chart I tried sth kile this and its worked. lineChart -> addSeries(CellRange("C7:C" + maxRow), xlsx.sheet("Sheet1")); max Row is my maximum row number. How can I append my end row to average function? here is library.
      Qxlsx examples folder

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @mangekoyu
      If you can't figure what your max row count is, your could just put 9999 in and that might do you :)

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mchinand
        wrote on last edited by
        #3

        @mangekoyu said in Qt c++ xlsx get maxımum row for calculate average:

        xlsx.write("B9", "=AVERAGE(B3:B5)", lAlign);

        Did you try something like:
        xlsx.write("B9", QString("=AVERAGE(B3:B%1)").arg(maxRow), lAlign);

        JonBJ 1 Reply Last reply
        0
        • M mchinand

          @mangekoyu said in Qt c++ xlsx get maxımum row for calculate average:

          xlsx.write("B9", "=AVERAGE(B3:B5)", lAlign);

          Did you try something like:
          xlsx.write("B9", QString("=AVERAGE(B3:B%1)").arg(maxRow), lAlign);

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @mchinand
          I think the OP's question is that he does not know the value to put in maxRow, not that he doesn't know how to output it. Hence my previous answer.

          D 1 Reply Last reply
          0
          • JonBJ JonB

            @mchinand
            I think the OP's question is that he does not know the value to put in maxRow, not that he doesn't know how to output it. Hence my previous answer.

            D Offline
            D Offline
            DerReisende
            wrote on last edited by
            #5

            @JonB can't you find the last row via 'Worksheet::dimension()'?

            JonBJ 1 Reply Last reply
            0
            • D DerReisende

              @JonB can't you find the last row via 'Worksheet::dimension()'?

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by
              #6

              @DerReisende
              I have no idea, I don't use or need QtXlsx. The OP might! Or he can plonk 9999 in there.

              1 Reply Last reply
              0
              • mangekoyuM Offline
                mangekoyuM Offline
                mangekoyu
                wrote on last edited by
                #7

                @JonB said in Qt c++ xlsx get maxımum row for calculate average:

                If you can't figure what your max row count is, your could just put 9999 in and that might do you :)

                @JonB I tried 'QString averval = "=AVERAGE(B7:B" + maxRow + ")";

                I can get this one when I debug it. "=AVERAGE(B7:B413)"

                JonBJ 1 Reply Last reply
                0
                • mangekoyuM mangekoyu

                  @JonB said in Qt c++ xlsx get maxımum row for calculate average:

                  If you can't figure what your max row count is, your could just put 9999 in and that might do you :)

                  @JonB I tried 'QString averval = "=AVERAGE(B7:B" + maxRow + ")";

                  I can get this one when I debug it. "=AVERAGE(B7:B413)"

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by
                  #8

                  @mangekoyu
                  So if you do know maxRow, or use 9999, either way what is your problem?

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved