Vai al contenuto principale

Come sommare / contare i numeri in grassetto in un intervallo di celle in Excel?

Autore: Xiaoyang Ultima modifica: 2022-05-16

Quando si dispone di un intervallo di dati che contiene alcuni numeri in grassetto in un foglio di lavoro e ora si desidera sommare o contare solo le celle in grassetto, ovviamente è possibile aggiungerle manualmente una per una, ma richiederà molto tempo. Come potresti sommare o contare solo le celle in grassetto in Excel in modo facile e veloce?

Contare i numeri in grassetto in un intervallo con la funzione definita dall'utente (VBA e formula)
Somma i numeri in grassetto in un intervallo con Funzione definita dall'utente (VBA e formula)
Diversi clic per contare e sommare le celle in grassetto in un intervallo con Kutools per Excel


Contare i numeri in grassetto in un intervallo con la funzione definita dall'utente

Le seguenti Funzione definita dall'utente può aiutarti a ottenere rapidamente il numero di celle in grassetto. Per favore, fai come segue:

1. Tieni premuto il ALT + F11 chiavi e apre il file Finestra di Microsoft Visual Basic, Applications Edition.

2. Clic inserire > Modulie incolla il codice seguente nel file Finestra del modulo.

Codice VBA: conta i numeri in grassetto in un intervallo di celle

Function CountBold(WorkRng As Range)
'Update 20220516
Dim Rng As Range
Dim xCount As Double
For Each Rng In WorkRng
    If Rng.Font.Bold Then
        xCount = xCount + 1
    End If
Next
CountBold = xCount
End Function

3. Quindi salva questo codice e digita questa formula = CountBold (A1: C9) in una cella vuota, vedi screenshot:

doc-count-bold-celle1

4. Quindi premere entrare chiave e conterai le celle in grassetto nell'intervallo A1: C9.

doc-count-bold-celle2

Nota:A1: C9 nella formula indica l'intervallo in cui si desidera utilizzare la funzione per contare le celle in grassetto, è possibile modificarlo secondo le proprie necessità.


Somma i numeri in grassetto in un intervallo con la funzione definita dall'utente

E se vuoi sommare solo i numeri in grassetto in un intervallo di dati, posso anche creare una funzione definita dall'utente per risolverlo.

1. Tenere premuto il tasto ALT + F11 chiavi e apre il file Finestra di Microsoft Visual Basic, Applications Edition.

2. Clic inserire > Modulie incolla il codice seguente nel file Finestra del modulo.

Codice VBA: somma i numeri in grassetto in un intervallo di celle

Function SumBold(WorkRng As Range)
'Update 20220516
Dim Rng As Range
Dim xSum As Double
For Each Rng In WorkRng
    If Rng.Font.Bold Then
        xSum = xSum + Rng.Value
    End If
Next
SumBold = xSum
End Function

3. Quindi salva questo codice e digita questa formula = sumbold (A1: C9) in una cella vuota, vedi screenshot:

doc-count-bold-celle3

4. E poi premere entrare chiave, tutti i numeri in grassetto nell'intervallo A1: C9 sono stati sommati. Vedi screenshot:

doc-count-bold-celle4

Nota:A1: C9 nella formula indica l'intervallo in cui si desidera utilizzare la funzione per sommare le celle in grassetto, è possibile modificarlo secondo le proprie necessità.


Diversi clic per contare e sommare le celle in grassetto in un intervallo con Kutools per Excel

YPuoi facilmente contare o sommare tutte le celle in grassetto in un intervallo con diversi clic senza gestire il codice VBA complicato e ricordare le formule.

Prima di applicare Kutools for Excel, Per favore scaricalo e installalo prima.

1. Per contare le celle in grassetto, selezionare una cella vuota per individuare il risultato, quindi fare clic su Kutools > Funzioni di Kutools > Statistica e matematica > COUNTBYFONTBOLD.

E per sommare le celle in grassetto, fare clic su Kutools > Funzioni di Kutools > Statistica e matematica > SUMBYFONTBOLD. Vedi screenshot:

2. Nella Fargomenti di unzione finestra di dialogo, specificare l'intervallo con celle in grassetto che è necessario contare o sommare nella casella Riferimento, quindi fare clic su OK pulsante.

Ora il conteggio o la somma di tutte le celle in grassetto nell'intervallo specificato vengono popolati immediatamente nella cella selezionata. Vedi screenshot:

  Se desideri avere una prova gratuita (30 giorni) di questa utility, fare clic per scaricarlo, quindi andare ad applicare l'operazione secondo i passaggi precedenti.


Mantieni costante il riferimento della cella della formula con Kutools per Excel


Articoli correlati:

Come identificare e selezionare tutte le celle o il testo in grassetto in Excel?

I migliori strumenti per la produttività in ufficio

🤖 Assistente AI di Kutools: Rivoluziona l'analisi dei dati basandosi su: Esecuzione intelligente   |  Genera codice  |  Crea formule personalizzate  |  Analizzare i dati e generare grafici  |  Richiama le funzioni di Kutools...
Funzioni popolari: Trova, evidenzia o identifica i duplicati   |  Elimina righe vuote   |  Combina colonne o celle senza perdere dati   |   Round senza formula ...
Super ricerca: VLookup a criteri multipli    VLookup a valori multipli  |   VLookup su più fogli   |   Ricerca fuzzy ....
Elenco a discesa avanzato: Crea rapidamente un elenco a discesa   |  Elenco a discesa dipendente   |  Elenco a discesa a selezione multipla ....
Gestore di colonna: Aggiungi un numero specifico di colonne  |  Sposta colonne  |  Attiva/disattiva lo stato di visibilità delle colonne nascoste  |  Confronta intervalli e colonne ...
Funzionalità in primo piano: Messa a fuoco della griglia   |  Vista di progettazione   |   Grande barra delle formule    Gestore di cartelle di lavoro e fogli   |  Resource Library (Testo automatico)   |  Date picker   |  Combina fogli di lavoro   |  Crittografa/decrittografa le celle    Invia e-mail per elenco   |  Super filtro   |   Filtro speciale (filtro grassetto/corsivo/barrato...) ...
I 15 migliori set di strumenti12 Testo Strumenti (aggiungi testo, Rimuovi personaggi, ...)   |   50+ Grafico Tipi (Diagramma di Gantt, ...)   |   40+ Pratico Formule (Calcola l'età in base al compleanno, ...)   |   19 Inserimento Strumenti (Inserisci il codice QR, Inserisci immagine dal percorso, ...)   |   12 Conversione Strumenti (Numeri in parole, Conversione di valuta, ...)   |   7 Unisci e dividi Strumenti (Combina righe avanzate, Celle divise, ...)   |   ... e altro ancora

Potenzia le tue competenze di Excel con Kutools per Excel e sperimenta l'efficienza come mai prima d'ora. Kutools per Excel offre oltre 300 funzionalità avanzate per aumentare la produttività e risparmiare tempo.  Fai clic qui per ottenere la funzionalità di cui hai più bisogno...

Descrizione


Office Tab porta l'interfaccia a schede in Office e semplifica notevolmente il tuo lavoro

  • Abilita la modifica e la lettura a schede in Word, Excel, PowerPoint, Publisher, Access, Visio e Project.
  • Apri e crea più documenti in nuove schede della stessa finestra, piuttosto che in nuove finestre.
  • Aumenta la produttività del 50% e riduce ogni giorno centinaia di clic del mouse!
Comments (22)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello Anthony,
I was struggling with the same problem. For me, the solution ended up being very simple. I noticed I had 4 Modules listed. I removed all of them and then started over with the above instructions. Now it works perfectly.
This comment was minimized by the moderator on the site
I use the function and keep getting the #NAME? error. I am using Excel 365 and Windows11.
This comment was minimized by the moderator on the site
Hello, Anthony

Have you copied and pasted the code into the Module of Microsoft Visual Basic for Applications window in your worksheet? Afetr pasting the code, then, you should enter the formula as you need.

Or you can upload your file here, we can check where the problem is.

Thank you!
This comment was minimized by the moderator on the site
Ma se metto in grassetto nuove celle, la somma non si aggiorna !!!
This comment was minimized by the moderator on the site
Hello Carlo,

Gald to help. After you bold new cells, the sum won't update automatically. But when you double-click the formula cell, then press Enter, the sum will update. Please have a try.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
Hi Mandy,
thanks for your reply,
Yes I know that after double click the sum will uograde.
Is there any way to upgrade automatically the sum ?

Regards
Carlo
This comment was minimized by the moderator on the site
Hello Carlo,

Sorry that I don't have the solution for automatically upgrading the sum. The easiest way I can think of is to press Ctrl + Alt + F9 to recalculate all worksheets in all open workbooks. Have a nice day.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
А если в ячейках числа и текст? надо просуммировать только ячейки с числами жирным шрифтом.
This comment was minimized by the moderator on the site
RE: CountBold formula This formula does not appear to be dynamic. While it works at first pass, if i change the bolded cells the counters do not update unless i re-enter the formula again. Any tips?
This comment was minimized by the moderator on the site
Yea this is the same for me, otherwise it works great. But if this could be solved so it refreshes the count after each cell deselect like other basic counts it would be perfect!
This comment was minimized by the moderator on the site
Dear guys,
The formula won't update if you just change the format of the number cells.
It updates only when you change the cell content.
This comment was minimized by the moderator on the site
I'm using excel for mac 2011. How can I run the code on my system? thanks!
This comment was minimized by the moderator on the site
I copied and pasted code into excel but get #NAME? error. I made sure to enable macros and using excel 2010 version (don't know if that changes anything). Can anyone please help?!
This comment was minimized by the moderator on the site
[quote]I copied and pasted code into excel but get #NAME? error. I made sure to enable macros and using excel 2010 version (don't know if that changes anything). Can anyone please help?!By Maey[/quote] You have to follow the instruction. It says: "Click Insert > Module, and paste the following code in the Module Window", and you have to do exactly so. Make sure you paste the code in the Module Window, not in the Sheet code Window.
This comment was minimized by the moderator on the site
Thank you.. it's working...
This comment was minimized by the moderator on the site
This works a treat. I only have one issue...it doesn't seem to be adding anything after a decimal point. Any help would be greatly appreciated.
This comment was minimized by the moderator on the site
This works perfectly except it doesn't seem to add my decimal places, only adds the whole dollar. If you have a fix for this I would be very grateful.
This comment was minimized by the moderator on the site
Hi Katie, Use the below code, as the sum shows decimal places. Function SumBold(rng As Range) Dim rCell As Range Application.Volatile SumBold = 0 For Each rCell In rng If rCell.Font.Bold Then _ SumBold = SumBold + rCell Next End Function
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations