WooCommerce – Ganga https://gangaramdas.com Learn how to Build Awesome Websites & Create a Web Design Business Sat, 08 Nov 2025 10:48:27 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://gangaramdas.com/wp-content/uploads/2020/06/cropped-small-favio-32x32.png WooCommerce – Ganga https://gangaramdas.com 32 32 How to Create a Sales Dashboard in Excel (Step-by-Step Guide with Code & Formulas) https://gangaramdas.com/how-to-create-a-sales-dashboard-in-excel-step-by-step-guide-with-code-formulas/ https://gangaramdas.com/how-to-create-a-sales-dashboard-in-excel-step-by-step-guide-with-code-formulas/#respond Sat, 08 Nov 2025 10:48:27 +0000 https://gangaramdas.com/?p=218497

Introduction:

A sales dashboard in Excel helps track key business metrics like revenue, profit, and sales performance over time. Whether you’re a beginner or a marketing analyst, this tutorial will walk you step-by-step through creating an interactive and automated dashboard in Excel — complete with charts, formulas, and VBA code snippets.

Step 1: Prepare Your Sales Data

Create a worksheet named “Sales_ Data” with columns like:
| Date | Product | Region | Salesperson | Units Sold | Unit Price | Total Sales |
|——|———-|———|————–|————-|————-|
| 01-Jan-2025 | Laptop | North | Priya | 5 | 55000 | =E2F2 |
| 02-Jan-2025 | Mobile | South | Rahul | 10 | 15000 | =E3
F3 |

Tip: Use Excel Tables (Ctrl + T) to make formulas and charts dynamic.

Step 2: Add Key Metrics (KPIs)

Create another sheet named “Dashboard” and calculate:

KPI Formula
Total Sales =SUM(Sales _Data[Total Sales])
Average Sale =AVERAGE(Sales_ Data[Total Sales])
Top Region =INDEX(Sales _Data[Region], MATCH(MAX(Sales _Data[Total Sales]), Sales_ Data[Total Sales], 0))

 Highlight these KPIs using Data Bars or Conditional Formatting for visual clarity.

Step 3: Create Interactive Charts

Go to Insert → Charts → Recommended Charts and choose:

  • Column Chart for Sales by Region

  • Line Chart for Sales Trend by Date

  • Pie Chart for Top Products

 To make the dashboard dynamic, use Slicers (Insert → Slicer → Select Region/Product).

Step 4: Add Interactivity with Excel Formulas

Use formulas like:

  • =SUMIFS(Sales _Data[Total Sales], Sales _Data[Region], "North")Sales for North region

  • =COUNTIFS(Sales _Data[Salesperson], "Priya")Number of deals closed by Priya

These formulas help your dashboard automatically update when filters change.

Step 5: Add VBA Code for Auto Refresh (Optional)

To auto-refresh PivotTables or charts when data changes, use a short VBA macro.

VBA Code:

Private Sub Worksheet _Change(By Val Target As Range)
If Not Intersect(Target, Sheets(" ").Used Range) Is Nothing Then
This Workbook. Refresh All
End If
End Sub

How to Add VBA Code:

  1. Press Alt + F11 → Open VBA Editor

  2. Right-click Sheet (Dashboard) → “View Code”

  3. Paste the above code

  4. Save file as .xlsm (macro-enabled workbook)

Step 6: Design & Polish Your Dashboard

Enhance visual appeal:
 Use shapes and icons for KPIs
 Add slicers for Region, Product, and Salesperson
 Apply consistent color themes
 Align charts neatly in a grid

Example layout:

  • Top: KPI Cards

  • Middle: Charts (Sales by Region, Product Performance)

  • Bottom: Trend Graph

Step 7: Test & Publish

  • Add new sales data and test auto-refresh

  • Ensure slicers and charts update dynamically

  • Export the dashboard as a PDF or Share Excel File with your team

Conclusion:

You’ve successfully built a fully functional Sales Dashboard in Excel using formulas, charts, and VBA. This powerful tool helps businesses visualize their sales performance, identify trends, and make data-driven decisions — all in one place! Suggested SEO Tags:

#ExcelDashboard #SalesDashboard #ExcelTutorial #DataAnalytics #BusinessIntelligence #ExcelVBA #DashboardDesign

]]>
https://gangaramdas.com/how-to-create-a-sales-dashboard-in-excel-step-by-step-guide-with-code-formulas/feed/ 0
How to add an “Ajax Add to Cart Button” Divi WooCommerce Shop Module https://gangaramdas.com/how-to-add-an-ajax-add-to-cart-button-divi-woocommerce-shop-module/ https://gangaramdas.com/how-to-add-an-ajax-add-to-cart-button-divi-woocommerce-shop-module/#respond Mon, 15 Aug 2022 19:29:02 +0000 https://gangaramdas.com/?p=218114 Add code to function.php files

 

/* Ajax Add to Cart button */
if ( ! function_exists( 'de_add_to_cart_button' ) ) {
    function de_add_to_cart_button(){
    	if ( true === et_get_option( 'add_to_cart', false ) ) {
        	add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 20 );
    	}
    }
    add_action( 'init', 'de_add_to_cart_button' );
}


 

/* Add Show/Hide Add to Cart button option */
if ( ! function_exists( 'de_append_theme_customizer' ) ) {
    function de_append_theme_customizer( $wp_customize ) {
        $wp_customize->add_setting( 'et_divi[add_to_cart]', array(
    		'type'			=> 'option',
    		'capability'	=> 'edit_theme_options',
    		'transport'		=> 'postMessage',
		    'sanitize_callback' => 'wp_validate_boolean',
    	) );
    	$wp_customize->add_control( 'et_divi[add_to_cart]', array(
    		'label'		=> esc_html__( 'Enable Add To Cart', 'Divi' ),
    		'section'	=> 'woocommerce_product_catalog',
    		'type'     => 'checkbox',
    	) );
    }
    add_action( 'customize_register', 'de_append_theme_customizer' );
}

CSS code to Theme Option

.woocommerce ul.products li.product .button {
    margin-top: 1em;
    background-color: #8b312e;
    color: #fff;
    border-radius: 0px;
    border-width: 0px;

}


.woocommerce-page a.button:after{
content: "\e079"; 
	font-size: 20px;
    padding-top: 5px;
    padding-left: 5px;
}

.woocommerce-page a.button:after{
content: "\e079";
	font-size: 20px;
    padding-top: 5px;
    padding-left: 5px;
}
.woocommerce a.added_to_cart{
color: #fefefe !important;
width: 50%;
margin-left: auto;
margin-right: auto;
float: right;
	
}
.woocommerce a.added_to_cart:after{
content: "\e079";
 font-family: ETmodules!important;
	font-size: 20px;
    padding-top: 5px;
    padding-left: 5px;
}

.woocommerce a.button.loading::after {
 content: "\e02d"; 
	font-size: 20px;
    padding-top: 5px;
    padding-left: 5px;
}

.woocommerce a.added_to_cart{
width: 50%;
margin-left: auto;
margin-right: auto;
float: left;
}


.woocommerce a.button.added::after {
    content: "\e079";
	font-family: ETmodules!important;
	font-size: 20px;
    padding-top: 5px;
    padding-left: 5px;
	
}

.archive .woocommerce a.added_to_cart{
color: #000 !important;
float: left;
}

 

]]>
https://gangaramdas.com/how-to-add-an-ajax-add-to-cart-button-divi-woocommerce-shop-module/feed/ 0
How to apply automatically a coupon based on specific cart items count in Woocommerce https://gangaramdas.com/apply-automatically-a-coupon-based-on-specific-cart-items-count-in-woocommerce/ https://gangaramdas.com/apply-automatically-a-coupon-based-on-specific-cart-items-count-in-woocommerce/#respond Sat, 22 Jan 2022 15:31:54 +0000 https://gangaramdas.com/?p=217644 In this blog, we are going to learn about the way to add coupon codes with product count in the cart. This code will work for all woocommerce WordPress website

Paste the below code to funcation.php file.

add_action( 'woocommerce_before_calculate_totals', 'auto_add_coupon_based_on_cart_items_count', 25, 1 );
function auto_add_coupon_based_on_cart_items_count( $cart ) {
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    // Setting and initialising variables
    $coupon = 'tasterbox'; // <===  Coupon code
    $item_count = 4; // <===  <===  Number of items
    $matched    = false;

    if( $cart->cart_contents_count >= $item_count ){
        $matched = true; // Set to true
    }

    // If conditions are matched add coupon is not applied
    if( $matched && ! $cart->has_discount( $coupon )){
        // Apply the coupon code
        $cart->add_discount( $coupon );

        // Optionally display a message
        wc_add_notice( __('TASTER BOX ADDED'), 'notice');
    }
    // If conditions are not matched and coupon has been appied
    elseif( ! $matched && $cart->has_discount( $coupon )){
        // Remove the coupon code
        $cart->remove_coupon( $coupon );

        // Optionally display a message
        wc_add_notice( __('SORRY, TASTERBOX NOT VALID'), 'error');
    }
}

]]>
https://gangaramdas.com/apply-automatically-a-coupon-based-on-specific-cart-items-count-in-woocommerce/feed/ 0