Vlookup / Sum / Automatic recognition

Jovinchious

New Member
Joined
Oct 12, 2022
Messages
19
Office Version
  1. 2007
Platform
  1. Windows
Hello everyone!

I should automate one calculation process, but this level of Macro is still too much for me. If someone is brave, I would appreciate very much :)

So I need a command that will:
1. using VLOOKUP or a similar function give the initial balance of the region from "sheet1"
2. give the sum in the AA column exclusively in the first row above each line/region (as shown in the picture).
Note - every day the table is different and the lines with the regions are different (sometimes there are all regions, sometimes there are several... sometimes there are more items within the region, sometimes less). A few days ago, I made a Macro that will underline and separate regions for me, that's why I need the numbers in the first line above the stroke/underline.

Thanks in advance!


EDIT:
ONE CORRECTION
...on the line "AB31" it should say "=U31..." ETC.
 

Attachments

  • p1.png
    p1.png
    84.7 KB · Views: 12
Last edited by a moderator:

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Additional explanation.

So, I made the following...

Sub AddBorderLineWhenValueChanges()
Application.ScreenUpdating = False
Dim LastRow As Long
Dim xrg As Range
LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
For Each xrg In Range("C2:C" & LastRow)
If xrg <> xrg.Offset(1, 0) Then
Range("A" & xrg.Row & ":AB" & xrg.Row).Borders(xlEdgeBottom).LineStyle = xlContinuous
End If
Next xrg
Application.ScreenUpdating = True

End Sub

...which gave me borders/lines which separate different "Regions" in Column A in sheet "ExportWorksheet" (in the original file "Region" is in column C but nevermind)
Right now I need to use "vlookup (i guess)" to drag data from "regions" in other sheet "sheet1"... data in "sheet1" is always fixed ... 8 regions are in C column (c1 - "Zagreb 1" ,c2 - "Zagreb 2",c3 - "Zagorje" ...), and data/balance of regions are in D column expressed in value/number (d1 - 23200, d2 - 800, d3 - 4500...).
Afterwards, when numbers are in place in U column at the bottom of each line/border, I need to sum that given number with other columns as presented in photo. The problem is that I cant use sum with fixed cells, while in every report there is a different number of items in each region (as you can see -> "Dalmatia" region in this report has 12 items, "Dalmatia Jug" 1 item, "Istra" 10 items...

So, pracitcally, I need macro that will do Vlookup at bottom of every line in "U" column, and sum at bottom of every line in "AB" column.

I hope its more clear now.
Thanks in advance!
 
Upvote 0

Forum statistics

Threads
1,215,661
Messages
6,126,091
Members
449,290
Latest member
mrsbean

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top