Archive

Posts Tagged ‘Hassan’

Coloring Some Sketches


Again I just pecked one of my sketches and color it using my galaxy Note9 mobile... Usually I use pencil then ink-ed the sketch, some time I color it with Watercolor or Promarker. Just to kill the time, I load one of them to the “Autodesk Sketchbook” App on my Galax Note9 and color it. The sketche is from my SKB 39 ..and here it is . .

More sketches on my-Sketch page.

Excel, VBA Codes and Formulas-4

March 26, 2020 Leave a comment

Learn To : In Excel – Highlight the Row when clicked.


Assume we have a table, and all we want to do is that if the user click anywhere in the table that ROW will change it’s color.



Steps
1. From the Top menu, Go to “Developer”, then Press Visual Basic.



2. from the select the sheet name containing the table. ( We have it in Sheet 2 )
3. Then we select “SelectionChange” action from the




4. Write this code:
If Not Intersect(ActiveCell, Range(“C8:E9999”)) Is Nothing Then
Range(“A1”).Value = Target.Row

End If

5. You need to know your Table Range, in my example, the range is (“C8:E9999”). I add the “9999” so i will be sure the even if we add more data to out Table the code will handle it.

6. Now we need to add a rule in the “Manage Roles” in “Conditional Formatting” from the Excel Menu. Here is how to Open it.


7. Select the “” then add new Rule, Follow the Image showing the steps to do that. Once we finish it should work fine.



Now, when the user click any cell in the Table the Row will change it’s color (Format) as we set it.

🙂 Have Fun ..



Follow me on Twitter..




By: Ali Radwani




Python and Excel P1

March 24, 2020 Leave a comment


Learning : Python and Excel Part-1
Subject: Read Excel file

In the coming four or five Lessons we will work on reading and writing to Excel file using Python code.

First we need to import os and Pandas as in coming code block, I will use os later to fetch file information. Also we will set the file_name variable to our file assuming it is in the same .py directory and we will call [read] the file in to df [dataframe]. Here is the code

 # Import and call the File into DataFrame.
 
  import os, pandas as pd
file_name = 'python_sheet_4.xlsx'
df = pd.read_excel(file_name, sheet_name='Sheet1')

Now let’s talk about my excel file “python_sheet_4.xlsx” has two sheets named “sheet1 and sheet2” both contin same table sheet1 the table start from cell A1 and in sheet2 the table start from cell C7. So first we will work on sheet1 that’s way we call sheet1 in our df setting statement.

Now we have the df (dataframe), and if we run the this code:

 # To print out the data from df DataFrame.
 
print(df)

The Output..



Here is the original shot for our excel table



Here is a list of commands that we can use..

sheets_name = (pd.ExcelFile(file_name)).sheet_names
print(‘\n Number of Sheets in the file: ‘,len(sheets_name))
print(‘\n Sheets Name :’,*sheets_name,sep=’,’)

Command Action
print(df) Print all the data in the table
print(df.head()) Print the first 5 record in the table
print(df.head(10)) Print the first 10 records in the table, and
print(df.head(x)) will will print the first x record.
print(df.columns) Print out the table header as a list along with data type.
print(*df.columns,sep=’,’) This command will printout only the table header separated by (,)
print(df.shape) This will print the size of the table, in our case the
out-put will be (17,3) so we have 17 records and 3 columns.


If we wanr only the number of records we shall use print(df.shape[0])
sheets_name = (pd.ExcelFile(file_name)).sheet_names This command will return the Number and name of sheets in the file, then we
can print it out like this:

print(‘\n Number of Sheets in the file: ‘,len(sheets_name))
print(‘\n Sheets Name :’,*sheets_name,sep=’,’)



To make things in a professional way, we will write a function so we can use it with other applications, here is it..

The Code
[Out-Put]:



To Download my Python code (.py) files Click-Here



Follow me on Twitter..




By: Ali Radwani




Excel, VBA Codes and Formulas-3

March 22, 2020 Leave a comment

Learn To : In Excel – SUMIF and SUMIFS [ Part-2 SUMIFs ]


In SUMIFS we are talking about more than one conditions to apply on the same range or other range before we calculate the SUM of the target range.

Case Assumption: As in Part-1, Assume we have a table, with 5 columns (as in image-1) columns titles are [Date, Item, Quantity, Price and Total] containing our Expendituer and we have another table call it Summaries, we want some totals to be in this table. We can see the main table [Expendituer] and the Summary table as in part-1 but here we will add a year column to the Item-Quantity box, so we want to have the Quantity of an Item in given year. Image-2.

Image-1

Image-2

So if we write 2018 in Cell I27 we Must get the Quantity of School Bags we bought in 2018. To do this we will write this formula:

SUMIFS ()

=SUMIFS(E22:E30, D22:D30,J28,C22:C30,”*”&I28)

So in Cell K28 we will write =SUMIFS(E22:E30, D22:D30,J28,C22:C30,”*”&I28)

then we can copy the formula to other cells.


Now we have the formula in all the cells we want, we may need to do a little changes to cells number or columns that may been changed during the copy. And here is a screen shot of what we must have.


🙂 Have Fun ..



Follow me on Twitter..




By: Ali Radwani




My Sketchbook



I am sketching to enhance my skill, here is one of sketches from my sketchbook using pencil as a guide-line and ink-pen to finish the drawing.

image


Click to Enlarge



::SketchBook::
Sketch of: Armedillo
Using: Ink-Pen
Date: 16 / 8 / 2015
SketchBook: SketchBook #  4
More Sketches: Click Here



Follow me on Twitter..


Inst_icon




Ali,

My Sketchbook



I am sketching to enhance my skill, here is one of sketches from my sketchbook using pencil as a guide-line and ink-pen to finish the drawing.

image


Click to Enlarge



::SketchBook::
Sketch of: ,,,,,,,,,,,,,,,
Using: Ink-Pen
Date: 16 / 8 / 2015
SketchBook: SketchBook #  6
More Sketches: Click Here



Follow me on Twitter..


Inst_icon




Ali,

My Sketchbook



I am sketching to enhance my skill, here is one of sketches from my sketchbook using pencil as a guide-line and ink-pen to finish the drawing.

image


Click to Enlarge



::SketchBook::
Sketch of: Elephant Face
Using: Ink-Pen
Date: 18 / 8 / 2015
SketchBook: SketchBook #  6
More Sketches: Click Here



Follow me on Twitter..


Inst_icon




Ali,