Converting [h]:mm value with toggle switch

masud8956

Board Regular
Joined
Oct 22, 2016
Messages
163
Office Version
  1. 2016
  2. 2011
  3. 2007
Platform
  1. Windows
Hi all,

I am trying to automatically convert a few 'durations' (in [h]:mm format) located at range D17:D21.

I need to use some toggle switches at E16:I16 to select what ratio to be displayed at cells E16:I16. e.g. at E16, the switch should either show Ratio 0.75:1 or Ratio 1:0.75 and that way it goes all the way up to I16 (except F16 as it shows just 1:1, no toggle required). The ratios are demarcated by "/" and colored for easy understanding.

A15B15C15D15E15F15G15H15I15
A16DURATIONRatio
(0.75:1)/
(1:0.75)
Ratio
1:1
Ratio
(1.5:1)/(1:1.5)
Ratio
(2:1)/(1:2)
Ratio
(2.5:1)/(1:2.5)
A170:451:00/0:330:450:30/1:070:22/1:300:18/1:52
A181:001:20/0:451:000:40/1:300:30/2:000:24/2:30
A191:302:00/1:071:301:00/2:150:45/3:000:36/3:45
A202:002:40/1:302:00 1:20/3:001:00/4:000:48/5:00
A212:303:20/1:522:301:40/3:451:15/5:001:00/6:15

<tbody>
</tbody>

When the toggle switch is selected to "Ratio 0.75:1" at E16, I want E17:E21 to calculate values at D17:D21 and convert it to 0.75:1 ratio and display only the black colored value.

And when the toggle switch is selected to "Ratio 1:0.75" at E16, I want E17:E21 to calculate values at D17:D21 and convert it to 1:0.75 ratio andto display only the green colored value.

Similar is the case for G16, H16 and I16 for toggle switches and their respective ranges to display converted values accordingly. The source is always D17:D21 for all the columns.

I have manually populated E17:I21 with the converted values for clarity.

Can anyone please help me with suitable formula so I can populate E17:I21 automatically?

Thank in advance!
 
*Note that the formula is getting the factor value from the ratio table from post #5 , if you want the formula to work without using the table we will need a different approach.

Thanks!

Actually, that's exactly what I need. I need to do this multiplication straightforward and without reference to any table.

Regards.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
And...

Meanwhile, I tried the following formula. I do not know why it did not work.

In C1,
=IF(SEARCH(":1",$B1)=1,$A1,$A1*SEARCH(":1",$B1))
returning a value 7:30 whereas it should had been 1:00.

Similarly in C2 I tried:
=IF(SEARCH(":1",$B2)=1,$A2,$A2*SEARCH(":1",$B2))
returning a value 9:00 instead of 1:30.

Did I mess up the formula or this formula is no good for this case?
 
Upvote 0
This works for me in C1;


Book1
ABC
11:30(1.5:1)1:00
23:00(2:1)1:30
31:30(1:1.5)1:00
43:00(1:2)1:30
Sheet1
Cell Formulas
RangeFormula
C1=A1/IF(ISNUMBER(SEARCH("(1:",B1)),VALUE(SUBSTITUTE(RIGHT(B1,LEN(B1)-SEARCH("(1:",B1)-2),")","")),VALUE(SUBSTITUTE(LEFT(B1,SEARCH(":1)",B1)-1),"(","")))
 
Upvote 0
Perfect solution for me!

Worked beautifully! Can't thank you enough! :)
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,078
Latest member
skydd

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