Formula to write to read from 1 cell

Kenjiorson

New Member
Joined
Oct 25, 2023
Messages
15
Platform
  1. Windows
Cell E5 auto add minutes from cell D5 when cell C5 input either 1 or 2.
1 is auto add 45 minutes and 2 is 90 minutes, 1 formula is in cell E1 and 2 is in cell E2.
=IF($C5=1,$D5+$E$1,IF($C5=2,$D5+$E$2,$D5))

If i want to add in Cell C5, S1 is 45 minutes and S2 is 90 minutes.
how do i edit the formula or need write a new one?

If cell i4 read from cell C5,
1=120, 2=160, S1=100 and S2=130
How do i write this formula too

Thank you in advance
 

Attachments

  • 3 time sheet.jpg
    3 time sheet.jpg
    54.4 KB · Views: 4

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
You already have the beginnings of a lookup table in E1 & E2, why not make is a real lookup table.
The lookup table can be on another sheet and will autoexpand if you use an actual Excel Table,
This will make future maintenance much easier.

PS: The time function looks like this
=time(hour, minute, second)
Since you are working in mins I have set hour and second to 0 and just using the minutes position.
(you could use mins/60/24)

Book1
ABCDEFGHIJKL
1Lookup
2IDMins to Add
3Method 1Method 2Logic Function160
4Time()/60/24290
5112:00 AM3:00 AM3:00 AMVlookupS1100
61S22:00 AM4:10 AM4:10 AMIfS2130
7
Sheet1
Cell Formulas
RangeFormula
E5E5=$D5+TIME(0,IFERROR(VLOOKUP($C5,$K$3:$L$6,2,FALSE),0),0)
F5F5=$D5+IFERROR(VLOOKUP($C5,$K$3:$L$6,2,FALSE),0)/60/24
E6E6=$D6+TIME(0,IF($C6=1,60,IF($C6=2,90,IF($C6="S1",100,IF($C6="S2",130)))),0)
F6F6=$D6+IF($C6=1,60,IF($C6=2,90,IF($C6="S1",100,IF($C6="S2",130))))/60/24
GE]
 
Last edited:
Upvote 0
You already have the beginnings of a lookup table in E1 & E2, why not make is a real lookup table.
The lookup table can be on another sheet and will autoexpand if you use an actual Excel Table,
This will make future maintenance much easier.

PS: The time function looks like this
=time(hour, minute, second)
Since you are working in mins I have set hour and second to 0 and just using the minutes position.
(you could use mins/60/24)

Book1
ABCDEFGHIJKL
1Lookup
2IDMins to Add
3Method 1Method 2Logic Function160
4Time()/60/24290
5112:00 AM3:00 AM3:00 AMVlookupS1100
61S22:00 AM4:10 AM4:10 AMIfS2130
7
Sheet1
Cell Formulas
RangeFormula
E5E5=$D5+TIME(0,IFERROR(VLOOKUP($C5,$K$3:$L$6,2,FALSE),0),0)
F5F5=$D5+IFERROR(VLOOKUP($C5,$K$3:$L$6,2,FALSE),0)/60/24
E6E6=$D6+TIME(0,IF($C6=1,60,IF($C6=2,90,IF($C6="S1",100,IF($C6="S2",130)))),0)
F6F6=$D6+IF($C6=1,60,IF($C6=2,90,IF($C6="S1",100,IF($C6="S2",130))))/60/24
GE]
Hi sorry i think i wrote wrongly, i will edit the part

If cell i4 read from cell C5,
1=$120, 2=$160, S1=$100 and S2=$130
How do i write this formula with only input in C5 and cell i4 will show

Thanks thanks for the help
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,274
Members
449,093
Latest member
Vincent Khandagale

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