Skip to content

Increase price by 10% in Excel using VB Formula

This is the code to add to your excel file in order for you to increase the price, Please pay special attention where it say's Call CheckDollar ("A") and so on. Basically, I don't know in which column or sheet you…

Sohaib Khan1 min read
Increase price by 10% in Excel using VB Formula — editorial illustration

This is the code to add to your excel file in order for you to increase the price, Please pay special attention where it say's Call CheckDollar ("A") and so on. Basically, I don't know in which column or sheet you have the price $ is placed so what this code does it will look for dollar sign and increase the price in my example by 5% or 10%

PLAINTEXT1 line
Cells(i, column).Value = (Cells(i, column).Value) * 1.05 

Above statement show's price increase by 5% and the following code shows price increase by 10%

PLAINTEXT28 lines
Public Sub main() 

Call CheckDollar("A") 
Call CheckDollar("B") 
Call CheckDollar("C") 
Call CheckDollar("D") 
Call CheckDollar("E") 
Call CheckDollar("F") 
Call CheckDollar("G") 
'etc 
End Sub 


Public Sub CheckDollar(column As String) 

Dim N As Long, i As Long 


N = Cells(Rows.Count, column).End(xlUp).Row 

For i = 1 To N 
' MsgBox (Cells(i, column).NumberFormatLocal) 
If InStr(Cells(i, column).NumberFormatLocal, "$$") > 0 Or Cells(i, column).NumberFormatLocal = "$#,##0.00" Then 
Cells(i, column).Value = (Cells(i, column).Value) * 1.1 
End If 
Next i 

End Sub

Enjoy.

Was this worth your time?

Continue reading

Full archive

17 min read

Automating Proxmox VM Deployment

In the world of virtualization and infrastructure management, efficiency is everything. Today, I'm excited to share our latest automation script that transforms the traditionally manual process of creating virtual…

5 min read

DocFlux 2.0: A PDF Knowledge Base

In this post, I’ll walk you through the journey of building DocFlux 2.0, a robust PDF knowledge base application using Python, FastAPI, and cutting-edge NLP tools like OpenAI’s API. We’ll also cover how the frontend…