Look up and add 1

ads_1471

Board Regular
Joined
Apr 19, 2016
Messages
58
Hi

After some help on a formula please which will make life so much easier.

What I am after is when a word is put into 1 column it will use this then to add 1 hour onto the hours on the same row.

Example below of table.

Basically when AL example is entered into Column F2 it then takes the hours from E2 and moved to G2 adding 1 hour on. then same with any entries below.

DateIncomeTime inTime OutHoursLocationTotal Hour + 1
2/8/22Coach11:0013:002AL Example3
5/8/22Coach10:0013:003AL Example4
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Book1
ABCDEFG
1DateIncomeTime inTime OutHoursLocationTotal Hour + 1
22/8/2022Coach11:0013:00 AL Example3
35/8/2022Coach10:0013:00 AL Example4
Sheet1
Cell Formulas
RangeFormula
E2:E3E2=IF(F2="",(D2-C2)*24,"")
G2:G3G2=IF(F2="","",(D2-C2)*24+1)
 
Upvote 0
Thanks for this. With the F column it can contain other words. Should of said this part sorry. But from the formula just want it to add on 1 hour when AL Example is entered.

Would I enter =IF(F2="AL Snooker","",(D2-C2)*24+1)
 
Upvote 0
Book1
ABCDEFG
1DateIncomeTime inTime OutHoursLocationTotal Hour + 1
22/8/2022Coach11:0013:002AL Snooker 
35/8/2022Coach10:0013:00 AL Example4
Sheet1
Cell Formulas
RangeFormula
E2:E3E2=IF(F2="AL Example","",(D2-C2)*24)
G2:G3G2=IF(E2<>"","",(D2-C2)*24+1)
 
Upvote 0
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Enter data in column F and press the ENTER key.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Column <> 6 Then Exit Sub
    Target.Offset(, 1) = Target.Offset(, -1) + 1
End Sub
 
Upvote 0
Would rather just use a formula rather than macros. Thanks.

All I am after is a formula for Column G to look up when column F has AL Example in and take how many hours are in column E placing the result in Column G but adding 1 hour to the end result. :(

This to be for each row
 
Upvote 0
Book1
ABCDEFG
1DateIncomeTime inTime OutHoursLocationTotal Hour + 1
22/8/2022Coach11:0013:002AL Snooker 
35/8/2022Coach10:0013:00 AL Example4
Sheet1
Cell Formulas
RangeFormula
E2:E3E2=IF(F2="AL Example","",(D2-C2)*24)
G2:G3G2=IF(E2<>"","",(D2-C2)*24+1)
Would rather just use a formula rather than macros. Thanks.

All I am after is a formula for Column G to look up when column F has AL Example in and take how many hours are in column E placing the result in Column G but adding 1 hour to the end result. :(

This to be for each row
 
Upvote 0
Hi

After some help on a formula please which will make life so much easier.

What I am after is when a word is put into 1 column it will use this then to add 1 hour onto the hours on the same row.

Example below of table.

Basically when AL example is entered into Column F2 it then takes the hours from E2 and moved to G2 adding 1 hour on. then same with any entries below.

DateIncomeTime inTime OutHoursLocationTotal Hour + 1
2/8/22Coach11:0013:002AL Example3
5/8/22Coach10:0013:003AL Example4
Hi,
Can you try...
If(f2<>" ",e2+1," ")
 
Upvote 0
Hi,
Can you try...
If(f2<>" ",e2+1," ")
Sorry, that didn't work. When hitting enter, it just came back with 2 hours, which was in the hour's field.

Basically anytime AL Example is in the CEL it should add 1 hour in the end column, If it has another word in then it should just be blank

Time InTime OutTotal HoursLocationhours used + 1
11:30​
12:30​
1​
AL SnookerShould be 2
13:00​
15:00​
2​
WalesBlank
13:00​
15:00​
2​
AL SnookerShould be 3
13:00​
15:00​
2​
MAnchesterBlank
13:00​
15:00​
2​
VenueBlank
 
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,309
Members
449,080
Latest member
jmsotelo

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