Excel OB and CB

alliswell

Board Regular
Joined
Mar 16, 2020
Messages
241
Office Version
  1. 2007
Platform
  1. Windows
  2. Mobile
Screenshot_20250323-073009.png

Hi, everybody. in column A are dates, in column B is OB(opening balance) and CB(closing balance for the current date above. Now when i enter date in A12, for example 03/03/2025 and in B12 i enter OB then excel should find previous date CB in C12 that is 690, (previous date CB was 690) 02/03/2025
 
Is this formula in C12 what you want?
Excel Formula:
=IF(B12="OB",LOOKUP(9^9,C$1:C11),"")
 
Upvote 0
Is this formula in C12 what you want?
Excel Formula:
=IF(B12="OB",LOOKUP(9^9,C$1:C11),"")
Mr peter its not working

Now when i put date in A16 that is 04/03/2025 and "OB" in B16 then excel should find CB of previous date and put its value in C16. Previous last date was 03/03/2025 and its CB was 1090, so now in C16 i must get 1090. I just want to carry forward last date closing balance(CB) to new date as opening balance(OB) and so on... to every new date i enter.

Sorry as i was unable to explain properly

Thanks and regards
 
Upvote 0
  1. Does that mean that you are looking for a vba solution?

  2. How did the 1090 get into C14?
 
Upvote 0
  1. Does that mean that you are looking for a vba solution?

  2. How did the 1090 get into C14?
Mr peter i just want the closing balance of 03/03/2025 in C16 of 04/03/2025

now just look, i have 2 transactions for date 03/03/2025 in column A. And last transaction of 03/03/2025 is in row A13. Now i want some tricky formula so that when i enter the date 04/03/2025 in A16 and OB in B16 then excel must check the last non-blank row of previous date 03/03/2025 and get the the previous
date CB from C10 in C16

I dont need VBA, its better if you provide nice formula. I know Mr peter have the solution. You solved all of my complex queries. You are the best. Everyone on MrExcel is genius but your tuning with me is that you understand what i want.

Thanks a lot.
 
Upvote 0
I can't see an way of doing your request in column C without writing a separate formula for each set of dates.
If you were using a separate column you could do the below.

Book1
ABCD
101/03/2025OB500 
201/03/2025100 
301/03/2025-30 
401/03/2025200 
5CB500
6 
702/03/2025OB770 
802/03/2025-50 
902/03/2025-30 
10CB770
11 
1203/03/2025OB690 
1303/03/2025400 
14CB690
Sheet1
Cell Formulas
RangeFormula
D1:D14D1=IF(B1="CB",LOOKUP(2,1/($B$1:$B1="OB"),$C$1:$C1),"")
 
Upvote 0
Actually ignore my last post as you are mentioning the previous date. Please post using XL2BB a manually entered example with the results that you want highlighted.
 
Upvote 0
Actually ignore my last post as you are mentioning the previous date. Please post using XL2BB a manually entered example with the results that you want highlighted.
See the image attached Mr. Mark
Can index match do the job ?
Or suggest any nice tricky formula
Thanks and regard
 

Attachments

  • Screenshot_20250324-045913.png
    Screenshot_20250324-045913.png
    176.6 KB · Views: 10
Upvote 0
May be you can try this,
Book1
ABC
1DateTypeAmount
21/3/2025OB500
31/3/2025100
41/3/2025-30
51/3/2025200
6CB770
72/3/2025OB770
82/3/2025OB770
92/3/2025-50
102/3/2025-30
11CB690
123/3/2025OB690
133/3/2025OB690
143/3/2025400
15CB1090
164/3/2025OB1090
Sheet2
Cell Formulas
RangeFormula
C7,C16,C12C7=IF(B7="OB", LOOKUP(2,1/(($A$1:$A$16<A7)*($B$1:$B$16="CB")*(ROW($A$1:$A$16)<ROW())), $C$1:$C$16), "")

Book1
ABC
1DateTypeAmount
21/3/2025OB500
31/3/2025100
41/3/2025-30
51/3/2025200
6CB770
72/3/2025OB770
82/3/2025OB770
92/3/2025-50
102/3/2025-30
11CB690
123/3/2025OB690
133/3/2025OB690
143/3/2025400
15CB1090
164/3/2025OB1090
Sheet1
Cell Formulas
RangeFormula
C7,C16,C12C7=IF($B$2="OB", LOOKUP(2,1/((A$1:INDIRECT("A"&ROW()-1)<$A$2)*(B$1:INDIRECT("B"&ROW()-1)="CB")), C$1:INDIRECT("C"&ROW()-1)), "")
 
Upvote 0

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